GithubHelp home page GithubHelp logo

retroed / esnow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kahlil/esnow

0.0 2.0 0.0 235 KB

The FUTURE is now. Write future JavaScript now everywhere all the time in a snap!

Home Page: https://www.npmjs.com/package/esnow

License: MIT License

JavaScript 100.00%

esnow's Introduction

esnow

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.

Usage

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

Using Node Packages

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.

Global Install

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.

Options

    --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`.

Todo

  • write better tests
  • add better cli with help with commander
  • use package.json for Browserify transforms
  • refactor this package to es6

Changelog

v2.0.0

  • The output filename does not default to "app.js" anymore. It defaults to the filename of your entryfile. Feature added by @andreruffert.

License

MIT © Kahlil Lechelt

esnow's People

Contributors

andreruffert avatar kahlil avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.