Skip to content

[gulp] JS Compilation

Crisoforo Gaspar Hernández edited this page Oct 12, 2015 · 2 revisions

js

This tasks will compile the .js files into one single file production.js and production-min.js (2 files to be exact) it will:

  • Compile the js files into one two files (mentioned above).
  • production.js has a source map to faster access to the original JS files and is un-minified.
  • production-min.js is the minified and compress version of the js and does not have a source map.

Usage

gulp js

This tasks has js:minify as one dependency, it will run js:minify before the execution of this task.

js:minify

This tasks will create a minified version of the one single js file. This minified version is used in production and does not have any source map.

Usage

gulp js:minify

This tasks has js:combine as one dependency, it will run js:combine before the execution of this task.

js:combine

This tasks will combine all of the files inside of jsFiles array, by updating that file from gulpfile.js you can add more files or remove some of the final result in the JS files. This tasks will create a single .js file and will associate a source map for debug purposes to this file.

Usage

gulp js:combine

js:lint

It will run both tasks: js:hint and js:cs, one after the another is finished and can be used for faster access to both single tasks. It will apply the JS rules against the .js files specified in the jsFiles array.

Usage

gulp js:lint

js:hint

It will apply the rules from .jshintrc file against the .js files specified in the jsFiles array. To make sure we follow the airbnb style guide for js files. This tasks does not break the gulp execution as js:hint-ci does.

Usage

gulp js:hint

js:cs

It will apply the rules from .jshintrc file against the .js files specified in the jsFiles array. To make sure we follow the airbnb style guide for js files. This tasks does not break the gulp execution as js:cs-ci does.

Usage

gulp js:cs