Re-usable, customisable default gulp tasks.
For a full, up-to-date list of tasks provided for your project run:
gulp help --tasks
The main tasks you may be interested in are:
cleancopy- Copy all files at the root level (app)fonts- Copy web fonts fromapp/fontsto disthtml- Scan your HTML for assets & optimize themicons- Combines all .svg icons inapp/icons/svginto font files & css codeimages- Optimize images inapp/imagesjshint- Lint JavaScriptpagespeed- Run PageSpeed Insightsscripts- Compile TypeScript to Javascriptserve&serve:dist- Run a Browsersync server, watch files for changes & reloadstyles- Compile Sass files into cssswagger- Generate client code from Swagger schemas (json or yaml)templates- Compile Angular HTML templates into a single Javascript file
sudo npm install -g typescript
sudo npm link typescript
Your gulpfile.js can be as simple as:
var gulp = require('gulp');
require('gulp-common-tasks')(gulp);You can add or over-ride your project-specific tasks after calling the two lines above.
Some of the tasks provided support (or require) externalised config in ./tasks/_config.js (relative to your application's root directory).
Your application-specific configuration will be merged in on top of the the default configuration provided in node_modules/gulp-common-tasks/tasks/_config.js.
By default, all output is written to .tmp. If you run gulp <some-task> --production the output will be written to dist.
You can customise this with by providing alternative configuation in .tasks/_config.js:
module.exports = {
paths: {
dest: argv.production ? 'dist' : '.tmp'
}
};The scripts task will compile TypeScript into Javascript. By default it will compile app/components/**/*.ts.
If you have TypeScript files in other paths you can provide alternative configuration.
module.exports = {
typescript: {
src: [
'app/components/**/*.ts'
]
}
};The templates task will generate javascript code including all of your html templates. The default configuration looks like this:
module.exports = {
templates: {
src: [
'app/components/**/*.html'
],
options: {
//module: 'templates',
//standalone: false,
//moduleSystem: 'RequireJS'
}
}
}; The swagger task will do nothing unless you provide an array of schemas:
module.exports = {
swagger: {
moduleName: 'app',
dest: '.tmp/',
schemas: [
{ 'MyApi': 'node_modules/api-package/swagger.yaml' }
]
}
};