This repo is not being maintained. I recommend you use budo instead.
Write ES2015 for the browser, import Node packages with the ES2015 module syntax and generate separate source maps.
esnow
is a Node package that preconfigures Browserify including the Babelify and Uglifyify transforms. It generates
separate source map files using Exorcist.
For watching and compiling changed files esnow uses watchify
. Watchify increases compile speed after the first compile because it uses caching.
It is very easy to use.
Install esnow
with npm.
npm install esnow --save-dev
Add an esnow
call it to your package.json scripts
field. Specify your entryfile with the -e
option and the output folder with the -o
option. esnow
will produce an main.js
and an main.js.map
in your output folder.
"scripts": {
"js": "esnow -e js/main.js -o out/js"
}
If you want to use Watchify just add -w
.
"scripts": {
"jsw": "esnow -e js/main.js -o out/js -w"
}
Execute it with npm.
npm run js
or
npm run jsw
Because we are using Browserify you can install and use node packages in your program of course.
Install a package as a devDependency:
npm install --save-dev some-cool-package
Then go ahead and import it in your program with the ES2015 module syntax:
import someCoolPackage from 'some-cool-package';
Then use it!
someCoolPackage();
The Babelify transform transpiles this to a CommonJS require
statement and passes it on to Browserify to bundle it up with your program.
You can also install and use it globally.
npm install -g esnow
Then just use it anywhere you want with the esnow
command.
esnow -e js/main.js -o out/js
or
esnow -e js/main.js -o out/js -w
Enjoy writing ESXXXX code with Node packages and debugging it easily via source maps.
--outputPath, -o Pass the output path (required).
--entryFile, -e Path to the entry file (required).
--watch, -w Watch and compile your files with watchify.
--prod, -p Production mode (minifies the code).
--outputFileName, -f Name of the output file defaults to the basename of `--entryFile`.
- write better tests
- add better cli with help with
commander
- use
package.json
for Browserify transforms - refactor this package to es6
- The output filename does not default to "app.js" anymore. It defaults to the filename of your entryfile. Feature added by @andreruffert.
MIT © Kahlil Lechelt