Tweet
Prepare
Create our tag
Mount
Riot and in-browser TRACEUR transpilation, (“React like”)
This is the reading of this article that inspired me: http://blog.srackham.com/posts/riot-es6-webpack-apps/.
Prerequisite
You need:
traceur.min.js
(bower install traceur
)traceur.min.map
rio.min.js
(bower install riot
)- you need an http server (this is very useful: https://www.npmjs.com/package/http-server)
So, you should have something like that:
my-app/
├── public/
| ├── js/
| | ├── tags
| | | └── yo-bob.js
| | └── bower_components/
| | ├── riot/
| | | └── riot.min.js
| | └── traceur/
| | └── traceur.min.js
| ├── index.html
| └── main.js
- create a
main.js
file inpublic
- create a
yo-bob.js
file inpublic/js/tags
Prepare index.html
Create our tag yo-bob
We will not use the riot tags but describe our component in JavaScript (ES2015), using ES6 Template Strings like that:
Edit yo-bob.js
:
Mount yo-tag
in the package
Edit main.js
:
“Run” it
cd my-app
http-server
Then, open http://localhost:8080
That’s all.
Tweet