Project tested with node v 6.2.2
A very basic boilerplate to start your Javascript project with ES6 script and using Browserify module bundler and Less css preprocessor.
Browserify lets you require('modules') in the browser by bundling up all of your dependencies.
-
The aim of this package is to start basic web project which usually have JS and css (less css) files, build them for release by compiling ES2015 code and concatenate multiple js and npm bundles into single file using
Browserify
and do the same for css style sheets. -
Bundling done with simple commands using Gulp which is famous build system to automate build process.
First, clone the repo via git:
git clone https://github.com/mizmaar3/gulp-es6-browserify-boilerplate your-project-name
And then install dependencies.
$ cd your-project-name && npm install
Run this command to build and bundle the project.
$ npm run build
or simple run
$ gulp
To get minified+uglified version of bundle.js please run
$ npm run release
inside your project folder
To start local server please run
$ npm run start
and goto http://127.0.0.1:9300 to test if code worked. You should get some text on the page.
- OS X: Cmd Alt I or F12
- Linux: Ctrl Shift I or F12
- Windows: Ctrl Shift I or F12
- So JS folder have three utility files and one main.js file which using utilities and showing some results in browser console.
Browserify
will do the magic for bundling. Everything whichRequire
in main.js or in util files will be appended into bundle.js after building the project.array-union.js
usingunderscore.js
to union some sets while ´get-mime-type.js´ using npm package calledsimple-mime
to get mimetype of a file. As utilities files have ES6 code it will be compiled bybabel js
after thatBrowserify
will append all dependencied into singlebundle.js
file.. Yes even wholeunderscore.js
can be found in ´bundle.js´ and of course wholesimple-mime
package and its dependencies as well.
- Less folder contains
.less
files which will be compiled withgulp-less
and concatenated into single filestyle.css
, can be found indist
folder after building project.