bjarosze / riot_js-rails

Muut Riot integration with Rails
28 stars 14 forks source link

Include babel for ES6 support in Riot #4

Closed brauliobo closed 9 years ago

brauliobo commented 9 years ago

If a <script type="es6"> tag is used, Riot will need Babel to work.

bjarosze commented 9 years ago

I will check it today evening.

bjarosze commented 9 years ago

You can install babel via npm: npm install babel

and next in bash: export NODE_PATH=/directory/to/your/node_modules

brauliobo commented 9 years ago

@bjarosze execjs will use the system's node modules?

bjarosze commented 9 years ago

Execjs executes system command (node in this case), so I don't know reason why it shouldn't use system's modules (even if there is note in execjs FAQ that require is not available). I've tested it and looks it works.

brauliobo commented 9 years ago

ok, will try that soon, closing for now. thanks!

brauliobo commented 9 years ago

@bjarosze I have installed babel with npm install -g babel and Error: Cannot find module 'babel' is still returned. Should it be required on execjs?

bjarosze commented 9 years ago

I've pushed new version with option to set path to modules in config/application.rb:

config.riot.node_paths << '/path/to/your/node_modules'

If you do not provide this config, gem will use global modules.