iio-codes
v0.1.2
Published
Our front-end build system uses gulp and browsersync to make front-end development faster and easier. Once it has been set up, you can simply run `gulp watch` to have the css on the local web site update when you save your less files.
Downloads
1
Readme
Front-end build system
Our front-end build system uses gulp and browsersync to make front-end
development faster and easier. Once it has been set up, you can simply run
gulp watch
to have the css on the local web site update when you save your
less files.
Required software
- Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. This has been tested with Node v.0.12.0.
- NPM, the Node package manager. This has been tested with NPM v.2.5.1.
- Gulp, the asynchronous build tool for Javascript. This has been tested with gulp v.3.8.11.
Platform installation
To build and develop the frontend of Silobreaker you need to install a recent version of nodejs. This can be downloaded from nodejs.
Make sure node.js and npm are installed and the right version by running the command
> node -v
v0.12.0
> npm -v
2.5.1
Once nodejs
and npm
have been downloaded install gulp globally with
> npm install -g [email protected]
> gulp -v
[13:08:49] CLI version 3.8.11
[13:08:49] Local version 3.8.11
Gulp is used to handle the different packages that are needed to build the website.
Package installation
Once gulp is installed globally, you have to install the packages needed for
the frontend build system. To do this, go to Silobreaker/Scripts/gulp
(the
location of package.json
) and run
> npm install
Now test your installation with
> gulp
It should display all the gulp tasks that are available.
Tasks and flags
Main Tasks
default
lists all the available tasks.deploy
runscompile:prod
for now. Produces minified code for production use.develop
runscompile:dev
for now. Outputs code with sourcemaps, for development and debugging.watch
runscompile:dev:watch
andbrowser:external:sync
. Continuously updates the browser when watched files (e.g. less-files) are saved.
Sub Tasks
browser:external:static
browser:external:sync
browser:static
browser:sync
compile:dev:watch
compile:prod
less:dev
less:dev:watch
less:prod
templates:angular:dev
templates:angular:dev:watch
templates:angular:prod
Flags
--production
Use this flag to use theconfig.prod.json
configuration. Often combined with thedeploy
task.
Configuration
All the configuration options for packages used in our build process are
collected in the config.dev.json
(for development work) and
config.prod.json
(for production deployment) files. It aims to collect
sensible defaults for the packages we use. Users can override development
default options in the config.local.json
file, which is ignored by git.
Example config.local.json
This configuration will make browsersync sync with both Firefox and Chrome,
always initialize at the HotSpots.aspx
page, and not display log messages in
the console. See the
browsersync documentation for more
info.
{
"browser": {
"options": {
"logLevel": "silent",
"startPath": "HotSpots.aspx",
"browser": "firefox"
}
}
}
Deployment to production
When you want to deploy this for the production environment, run all the
commands with the --production
flag, like
> npm install --production
> gulp deploy --production
This will install only the production dependencies, and use the production config file when building with gulp.
Dependencies
To make sure the project builds correctly, all the dependencies are exact.
Dependencies
gulp
: 3.8.11gulp-autoprefixer
: 2.1.0gulp-base64
: 0.1.2gulp-combine-media-queries
: 0.2.0gulp-less
: 3.0.0gulp-minify-css
: 0.4.5gulp-minify-html
: 0.1.8gulp-ng-template
: 0.1.2gulp-plumber
: 0.6.6gulp-rename
: 1.2.0gulp-task-listing
: 1.0.0gulp-util
: 3.0.3lodash
: 3.2.0yargs
: 3.0.4
Development dependencies
browser-sync
: 2.1.6gulp-sourcemaps
: 1.3.0open
: 0.0.5
These are specified in the package.json
file.