fuse-babel v1.0.1
fuse-babel
Command-line file watcher tool that enables using EcmaScript 2015 with in both Fuse preview and export.
Installing
Make sure you have Node.js and NPM installed, then in a terminal do
npm install -g fuse-babel
Usage
With a terminal in your Fuse project folder, do:
fuse-babel
This compiles all .js
files in your project into a mirror folder structure under generated/
, watches for changes and incrementally
recompiles files until you terminate the progrm with Ctrl+C
.
Configuring your Fuse project
Make sure your .unoproj
catches all .js
files into :Bundle
, for example do:
"Includes" : [
"*",
"**.js:Bundle"
]
This will include both the original es2015 source code, and the generated ES5.1 code in the bundle. However, Fuse's require()
-implementation will prioritize modules from the /generated
folder over corresponding files in the project root. Hence it "just works" as you would hope!
Using ES2015 with <JavaScript>
tags
ES2015 can unfortunately not be used for inline code in <JavaScript>
tags.
However if you use the Source
property (instead of File
) you can point to a ES2015 file relative to the UX document, and Fuse will resolve to the corresponding file in the /generated
folder at runtime.
<JavaScript Source="someES2015file.js" />
Enjoy!