You can use PLON Gulp in two ways:
- As NPM package - just copy
gulpfile.jsinto your project directory and andjust configuration in it. We recommend this option. - Or just copy file
gulpfile.jsandgulp/directory into your project.
To be able of using PLON Gulp tasks install required npm packages:
$ npm installThan you can generate dist files by entering:
$ gulpor any other gulp command described bellow.
gulp sass- Compiles all SASS files from 'assets' and moves results to 'dist'.gulp js- Uglifies and concatenates all JS files from 'assets' and moves results to 'dist'.gulp images- Copies all images from 'assets' to 'dist'.gulp fonts- Copies all fonts from 'assets' to 'dist'.gulp watch- Enters watch mode. Monitors changes in JS, CSS, Images and Fonts assets.gulp serve- Enters watch mode and starts simple server that serves same browser experience on different browsers through generated URL.
Gulp tasks can work in two modes:
-
"development" mode creates unminified files with source maps added. You can use this mode by adding
-D,--devor--developmentswitch in console, eg.:$ gulp js -D. This is default mode, so if you use$ gulpit means that you use "dev" mode. -
"production" mode creates minified files without source maps. You can use this mode by adding
-P,--prodor--productionswitch in console, eg.:$ gulp js -P.
PLON Gulp allows you to add new task to existing structure. You can do that in two ways:
- By writing your task directly in
gulpfile.js. There isgulpvariable available. - By creating custom task module the same way as they are created in gulp/tasks/ directory. This task could be loaded this way:
var plon = require('./node_modules/plon/gulp/index.js')(config);
// Second param is a location of directory that contains task module
plon.importTask('some-custom-task', '../../../gulp/tasks/');