web-build-tasks v0.0.5
web-build-tasks 
Gulp build tasks for single-page web applications, using coffeescript, browserify, pug and mocha for testing.
This package was created to ease the build process of some simple static web apps I created and is not meant as a general-purpose package.
Usage
To define the web-build-tasks tasks in your gulpfile:
var gulp = require('gulp');
var webBuildTasks = require('web-build-tasks');
var options = { /*web-build-tasks options*/ };
webBuildTasks.define(gulp, options);API
webBuildTasks.define(gulp, options?)Defines all web-build-tasks gulp tasks using gulp and the given options object. options is optional. Available options are (with defaults, note the interpolation syntax from coffeescript):
srcPath = './app': path for the source files of the applicationdestPath = './dist': path where the target application files will be written to for applicable gulp tasksscriptPath = '/src': sub-path for bothsrcPathanddestPathwhere the coffeescript files are locatedtestPath = './test': path for the test coffeescript filesperfGlob = "#{testPath}/**/perf*.coffee": glob for the performance test coffeescript filescoffeeGlobs = ['./gulpfile.coffee', "#{srcPath}#{scriptPath}/**/*.coffee", "#{testPath}/**/*.coffee"]: array of globs for coffeescript filescopyGlob = "#{srcPath}/**/*.!(coffee|pug|html|css)": glob for files to be copied verbatim todestPath.rootGlobs = ["#{srcPath}#{scriptPath}/main*.coffee"]: globs for the root coffeescript files of the applicationcdnEntries = []: array of options for thecdnizetask (see below)
Tasks
The gulp tasks that are defined can be divided in 4 categories: main build, performance tests, serve and deploy. Only the main build tasks are run by default when not specifying a task for gulp.
Some tasks create separate temporary folders for generated and transformed files, and you might want to add them to your .gitignore:
# dist is the default for options.destPath, adapt it accordingly
dist
.tmp
.publishMain build tasks
These are the main build gulp tasks provided:
lint: runsgulp-coffeelinton theoptions.coffeeGlobsfiles.test, depends onlint: runsgulp-mochaon all coffeescript files found onoptions.testPath, excluding all performance test files fromoptions.perfGlob.scripts, depends ontest: runsbrowserifyon all files fromoptions.rootGlobs, uglifying with source maps.pug: runsgulp-pugon all pug files found onoptions.srcPath. Writes the results to a temporary folder.tmp.html, depends onpug: optimizes CSS files and minifies HTML files.copy: copies alloptions.copyGlobfiles tooptions.destPath.clean: deletes all generated folders.build, tuns tasksclean,scriptsandhtml, this is also the default gulp task.
The ones more applicable to be run manually are lint, test, clean and the default (same as build):
$ gulp lint
$ gulp test
$ gulp clean
$ gulpPerformance test task
Since performance tests can be a lot slower than functional tests, they're not executed as part of the main build test task. The perf task, which depends on the lint task, can be used to run gulp-mocha on all options.perfGlob files.
$ gulp perfServe tasks
The serve tasks are for live development, serving the application with live-reload.
connect, depends onbuild: starts a connect server for the application in port 9000. Also serves/bower_componentsaccordingly.watch, depends onconnect: sets up live-reload for all source files.serve: runs thewatchtask and launches the application in a browser.
$ gulp serveDeploy tasks
The application can be deployed to a GitHub Pages repository:
cdnize, depends onbuild: usesgulp-cdnizerwith theoptions.cdnEntrieson all target HTML files.deploy, depends oncdnize: usesgulp-gh-pagesto deploy the application to a GitHub Pages repository.
$ gulp deployLicense
Licensed under the MIT license.