1 | # load-common-gulp-tasks [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]
|
2 | > Load common [gulp](http://gulpjs.com/) tasks and configs so you don't need to redefine them for every module
|
3 |
|
4 | Supplies a common interface to the following gulp modules:
|
5 |
|
6 | 1. [gulp-mocha](https://github.com/sindresorhus/gulp-mocha)
|
7 | 2. [gulp-jshint](https://github.com/spenceralger/gulp-jshint)
|
8 | 3. [gulp-istanbul](https://github.com/SBoudrias/gulp-istanbul)
|
9 | 4. [gulp-istanbul-enforcer](https://github.com/iainjmitchell/gulp-istanbul-enforcer)
|
10 | 5. [gulp-plato](https://github.com/sindresorhus/gulp-plato)
|
11 | 6. [gulp-help](https://github.com/chmontgomery/gulp-help)
|
12 | 6. [gulp-nice-package](https://github.com/chmontgomery/gulp-nice-package)
|
13 | 6. [gulp-shrinkwrap](https://github.com/chmontgomery/gulp-shrinkwrap)
|
14 |
|
15 | ## Available Tasks
|
16 |
|
17 | `gulp help` for available tasks. Right now these are the default tasks:
|
18 |
|
19 | ![](screenshot.png)
|
20 |
|
21 | ### Debug Tests
|
22 |
|
23 | You can debug your mocha tests using a tool like [node-inspector](https://github.com/node-inspector/node-inspector)
|
24 | combined with the `gulp test-debug` target
|
25 |
|
26 | ## Basic Usage
|
27 |
|
28 | ```js
|
29 | // gulpfile.js
|
30 | var gulp = require('load-common-gulp-tasks')(require('gulp'));
|
31 | ```
|
32 |
|
33 | ## Options
|
34 |
|
35 | `load-common-gulp-tasks` tries to assume smart defaults but also attempts to be very configurable.
|
36 | Each option can be overridden by passing an `options` object as the second parameter,
|
37 | e.g. `require('load-common-gulp-tasks')(gulp, options);`
|
38 |
|
39 | ### options.istanbul
|
40 |
|
41 | Type: `Object`
|
42 |
|
43 | Default:
|
44 | ```js
|
45 | {
|
46 | includeUntested: true
|
47 | }
|
48 | ```
|
49 |
|
50 | [See here for all available options](https://github.com/SBoudrias/gulp-istanbul#istanbulopt)
|
51 |
|
52 | ### options.istanbulWriteReports
|
53 |
|
54 | Type: `Object`
|
55 |
|
56 | Default:
|
57 | ```js
|
58 | {
|
59 | dir: './target/coverage'
|
60 | }
|
61 | ```
|
62 |
|
63 | [See here for all available options](https://github.com/SBoudrias/gulp-istanbul#istanbulwritereportsopt)
|
64 |
|
65 | ### options.istanbulEnforcer
|
66 |
|
67 | Type: `Object`
|
68 |
|
69 | Default:
|
70 | ```js
|
71 | {
|
72 | thresholds: {
|
73 | statements: 80,
|
74 | branches: 70,
|
75 | lines: 80,
|
76 | functions: 80
|
77 | },
|
78 | coverageDirectory: './target/coverage',
|
79 | rootDirectory: ''
|
80 | }
|
81 | ```
|
82 |
|
83 | [See here for all available options](https://github.com/iainjmitchell/gulp-istanbul-enforcer#options)
|
84 |
|
85 | ### options.paths
|
86 |
|
87 | Type: `Object`
|
88 |
|
89 | Default:
|
90 | ```js
|
91 | {
|
92 | lint: [
|
93 | './*.js',
|
94 | './lib/**/*.js',
|
95 | './test/**/*.js'
|
96 | ],
|
97 | felint: [
|
98 | './content/**/*.js'
|
99 | ],
|
100 | cover: [
|
101 | './lib/**/*.js'
|
102 | ],
|
103 | test: [
|
104 | './test/**/*.js'
|
105 | ]
|
106 | }
|
107 | ```
|
108 |
|
109 | Glob paths used by the associated targets
|
110 |
|
111 | ### options.jshintrc.server
|
112 |
|
113 | Type: `String`
|
114 |
|
115 | Default: `node_modules/load-common-gulp-tasks/lint/.jshintrc`
|
116 |
|
117 | `.jshintrc` file to use when running `gulp lint` target
|
118 |
|
119 | ### options.jshintrc.client
|
120 |
|
121 | Type: `String`
|
122 |
|
123 | Default: `node_modules/load-common-gulp-tasks/felint/.jshintrc`
|
124 |
|
125 | `.jshintrc` file to use when running `gulp felint` target
|
126 |
|
127 | ### options.complexity.destDir
|
128 |
|
129 | Type: `String`
|
130 |
|
131 | Default: `./target/complexity`
|
132 |
|
133 | Report destination.
|
134 |
|
135 | ### options.complexity.options
|
136 |
|
137 | Type: `Object`
|
138 |
|
139 | Default: `{}`
|
140 |
|
141 | [Options](https://github.com/philbooth/complexity-report#command-line-options) passed to complexity-report.
|
142 |
|
143 | ### options.showStreamSize
|
144 |
|
145 | Type: `Boolean`
|
146 |
|
147 | Default: `false`
|
148 |
|
149 | Optionally show the gulp stream size of each task
|
150 |
|
151 | ### options.nicePackage.spec
|
152 |
|
153 | Type: `String`
|
154 |
|
155 | Default: `npm`
|
156 |
|
157 | spec option for [package.json-validator](https://github.com/gorillamania/package.json-validator#api)
|
158 |
|
159 | ### options.nicePackage.options
|
160 |
|
161 | Type: `Object`
|
162 |
|
163 | Default:
|
164 | ```js
|
165 | {
|
166 | warnings: false,
|
167 | recommendations: false
|
168 | }
|
169 | ```
|
170 |
|
171 | spec option for [package.json-validator](https://github.com/gorillamania/package.json-validator#api)
|
172 |
|
173 | ## Advanced Usage
|
174 |
|
175 | To override default tasks or create new ones, simply define them after calling `require('load-common-gulp-tasks')(gulp);` in your `gulpfile.js`, e.g.
|
176 |
|
177 | ```js
|
178 | var gulp = require('gulp'),
|
179 | sass = require('gulp-sass'),
|
180 | sassFiles = './lib/*/sass/*.scss',
|
181 | options;
|
182 |
|
183 | // ------------------------
|
184 | // custom coverage settings
|
185 | // ------------------------
|
186 | options = {
|
187 | istanbulEnforcer: {
|
188 | thresholds: {
|
189 | statements: 83, // higher than default
|
190 | branches: 59, // lower than default
|
191 | // lines not defined. use default
|
192 | functions: 58
|
193 | }
|
194 | }
|
195 | };
|
196 |
|
197 | // ------------------------
|
198 | // load common tasks
|
199 | // ------------------------
|
200 | require('load-common-gulp-tasks')(gulp, options);
|
201 |
|
202 | // ------------------------
|
203 | // custom tasks
|
204 | // ------------------------
|
205 | gulp.task('watch', 'Watch sass files and recompile on change', function () {
|
206 | gulp.watch(sassFiles, ['styles']);
|
207 | });
|
208 |
|
209 | gulp.task('styles', 'Compile sass to css', function () {
|
210 | return gulp.src(sassFiles)
|
211 | .pipe(sass())
|
212 | .pipe(gulp.dest('./public'));
|
213 | });
|
214 | ```
|
215 |
|
216 | ## License
|
217 |
|
218 | [MIT](http://opensource.org/licenses/MIT) © [Chris Montgomery](http://www.chrismontgomery.info/)
|
219 |
|
220 | [npm-url]: https://npmjs.org/package/load-common-gulp-tasks
|
221 | [npm-image]: http://img.shields.io/npm/v/load-common-gulp-tasks.svg
|
222 | [travis-image]: https://travis-ci.org/areusjs/load-common-gulp-tasks.svg?branch=master
|
223 | [travis-url]: https://travis-ci.org/areusjs/load-common-gulp-tasks |
\ | No newline at end of file |