gulp-es6-browserify-boilerplate v1.0.1
gulp-es6-browserify-boilerplate
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
Browserifyand do the same for css style sheets.Bundling done with simple commands using Gulp which is famous build system to automate build process.
Install
First, clone the repo via git:
git clone https://github.com/mizmaar3/gulp-es6-browserify-boilerplate your-project-nameAnd then install dependencies.
$ cd your-project-name && npm installBuild
Run this command to build and bundle the project.
$ npm run buildor simple run
$ gulpTo enable source mapping please run
$ npm run build:devinside your project folder
Start Server
To start local server please run
$ npm run startand goto http://127.0.0.1:9300 to test if code worked. You should get some text on the page.
DevTools
Toggle Chrome DevTools
- OS X: Cmd Alt I or F12
- Linux: Ctrl Shift I or F12
- Windows: Ctrl Shift I or F12
Example Code Explanation
The JS folder
- So JS folder have three utility files and one main.js file which using utilities and showing some results in browser console.
Browserifywill do the magic for bundling. Everything whichRequirein main.js or in util files will be appended into bundle.js after building the project.array-union.jsusingunderscore.jsto union some sets whileget-mime-type.jsusing npm package calledsimple-mimeto get mimetype of a file. As utilities files have ES6 code it will be compiled bybabel jsafter thatBrowserifywill append all dependencied into singlebundle.jsfile... Yes even wholeunderscore.jscan be found inbundle.jsand of course wholesimple-mimepackage and its dependencies as well.
The LESS folder
- Less folder contains
.lessfiles which will be compiled withgulp-lessand concatenated into single filestyle.css, can be found indistfolder after building project.
9 years ago