-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
52 lines (47 loc) · 1.34 KB
/
Copy pathgulpfile.js
File metadata and controls
52 lines (47 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
var gulp = require('gulp'),
lazypipe = require('lazypipe'),
plugins = {},
list = {
docs: {
src: ['./source/*.js', './source/**/*.js'],
pipe: lazypipe()
.pipe(plugin('yuidoc'), {
project: {name: 'UI Library', description: 'Simple library for everyday UI components', version: '0.0.1'}
}, {
themedir: './node_modules/yuidoc-bootstrap-theme', helpers: ['./node_modules/yuidoc-bootstrap-theme/helpers/helpers.js']
}
)
.pipe(gulp.dest, './docs'),
skip: true
},
script: {
src: ['./source/*.js', './source/**/*.js'],
pipe: lazypipe()
.pipe(plugin('jshint'))
.pipe(plugin('jshint').reporter, 'jshint-stylish')
.pipe(gulp.dest, './build/normal')
.pipe(plugin('uglify'))
.pipe(plugin('rename'), function(path) { path.basename += '.min'; })
.pipe(gulp.dest, './build/minified')
}
},
keys = Object.keys(list);
function plugin(name) {
if (!(name in plugins))
plugins[name] = require('gulp-' + name);
return plugins[name];
}
keys.map(function(type) {
gulp.task(type, function() {
gulp.src(list[type].src).pipe(list[type].pipe());
});
});
gulp.task('watch', function() {
keys.map(function(type) {
if (!list[type].skip)
gulp.watch(list[type].src, [type]);
});
});
gulp.task('default', ['watch'].concat(keys.filter(function(type) {
return !list[type].skip;
})));