This document describes the Front-end build process.
The following tools are used:
- Build - Node 6.5.0, Gulp
- Packages - Npm, Bower
- Docs - YuiDocs
- JavaScript - Browserify, Babelify, Uglify, ESLint
- Stylesheets - PostCSS, CSSNext, CSSClean
- HTML - Handlebars
- Images - ImageMin
Install the required version of Node.js:
Mac/Linux: $ chmod 770 node-install.sh & ./node-install.sh -i
Windows: $ node-install.cmd --i
Builds source code from /src into /web. Starts a watch on files in /src.
$ npm install
$ npm run dev
Minifies all code. Skips installing optionalDependencies in package.json.
$ npm install --no-optional
$ npm run prod
Starts a BrowserSync development server @ http://localhost:3000
$ npm run serve
Optimize GIF/PNG/JPG/SVG images. Images are losslessly compressed, and will replace the original versions.
$ npm run optimize
Generates documentation based on JavaScript docblocks, writes to /docs.
$ npm run docs
Lints all JavaScript files for syntax issues.
$ npm run lint
Vary build options based on the target environment:
- env/default.env - base configuration.
- env/development.env - overrides for dev environment
- env/local.env - overrides for local environment. This is for your personal use only, do not commit this file.
Two separate bundles are created for JavaScript:
- main.js - built from our own code in /src/assets/scripts
- vendor.js - built from third-party libs in /src/assets/vendor
Use npm whenever possible to install third party libraries. Add a new entry in package.json, under "dependencies"
If a library you want to use is NOT hosted in npm, do the following:
- Add an entry to the file bower.json
- Run
bower install
to download the library to /assets/vendor - Add an alias for the library in package.json under "browser"
- If the library is not CommonJS-compatible, add an entry to "browserify-shim"
- Please commit all libraries in /assets/vendor to source control