riot/examples

Plunker Integration question

suchja opened this issue · 2 comments

Maybe a little of topic, but I really like your Integration with plunker. Unfortunately I can't find out how it works. Do you know of any tutorial or article describing how to achieve it?

Thank you!

look here the form is submitted with the values generated by the tag

  <form name="form" method="post" action="http://plnkr.co/edit/?p=preview">
    <input type="hidden" name="description" value={ manifest.title || 'Riot Example' }>
    <input type="hidden" name="private" value="true">
    <input type="hidden" name="tags[0]" value="riotjs">
    <input type="hidden" name="tags[1]" value="example">
    <input each={ files } type="hidden" name="files[{ name }]" value={ content }>
  </form>

each file you send is mapped from the object

{ name: name, content: content }

to the form element <input each={ files } type="hidden" name="files[{ name }]" value={ content }>

which translates to for example:

<input type="hidden" name="files[index.html]" value="<html>...</html>">
<input type="hidden" name="files[script.js]" value="function doSomething() {...}">

the value attribute is the full content of the file you wish to load

That's really cool! Thank you for this detailed explanation.