Skip to content

Instantly share code, notes, and snippets.

@GianlucaGuarini
Last active March 1, 2018 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GianlucaGuarini/2a52e7bd48166de30cb7ede9121afa64 to your computer and use it in GitHub Desktop.
Save GianlucaGuarini/2a52e7bd48166de30cb7ede9121afa64 to your computer and use it in GitHub Desktop.
Simple example to demonstarte how to use es2015 imports with the default riot cli. Install riot via `npm i riot -g` and then run `npm run build`
<main-tag>
<h1>I got the power!</h1>
<h2>The answer is { answer }</h2>
<script>
import something from './something'
this.answer = something.answer
</script>
</main-tag>
{
"name": "riot-rollup",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "riot main.tag main.in.js && rollup main.in.js > main.out.js"
},
"author": "Gianluca Guarini <gianluca.guarini@gmail.com> (http://gianlucaguarini.com)",
"license": "MIT",
"dependencies": {
"rollup": "^0.41.6"
}
}
export default {
daAnswer: 42
}
@IanRr
Copy link

IanRr commented Mar 1, 2018

Thanks, this was helpful to me -- but also, to anybody looking at this, I'm pretty sure daAnswer is a typo and not any sort of weird prefixing like I was briefly worried about. The property should be either answer or daAnswer but not both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment