Skip to content

Instantly share code, notes, and snippets.

@JSila
Last active October 3, 2015 14:55
Show Gist options
  • Save JSila/a3060d7e8cc334c01f4b to your computer and use it in GitHub Desktop.
Save JSila/a3060d7e8cc334c01f4b to your computer and use it in GitHub Desktop.
Quick set-up for ES6 project with babel and browserify.

It's easy! There are only 2 steps:

  1. Install required packages with NPM: npm install browserify babelify

  2. Create package.json with the following content (here main.js file is source file and bundle.js is output file. Also note we are applying transformer to browserify command):

    {
      "scripts": {
        "build-js": "browserify -t babelify main.js > bundle.js"
      }
    }

Thats it! Now whenever you feel to build up your ES6 code (main.js), just fire npm run build-js. If you are wondering why building via NPM: it allows you to call commands that are installed on project level (so you don't have to pollute global node_modules).

So have a fun writing JavaScript of tomorrow! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment