-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
56 lines (50 loc) · 1.9 KB
/
build.js
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
53
54
/**
* Created by majun on 2016/10/22.
*/
'use strict';
var gulp = require('gulp'),
del = require('del'),
config = require('./config');
module.exports = {
start : function (model, env) {
if (typeof model === 'object') {
var _name = model.name,
_resources = model.resources,
_dist = config.dist;
if (_name && _resources && typeof _resources === 'object') {
require('./task/delete').create(_name, _resources, _dist);
require('./task/styles').create(_name, _resources, _dist, env);
require('./task/scripts').create(_name, _resources, _dist, env);
require('./task/images').create(_name, _resources, _dist);
require('./task/views').create(_name, _resources, _dist);
require('./task/move').create(_name, _resources, _dist);
return gulp.task(_name, [_name + '-views', _name + '-images-min', _name + '-move']);
}
}
},
remove : function () {
return del(['rev-manifest-js.json',
'rev-manifest-css.json',
config.dist.static + '/*',
config.dist.views + '/*'],
{"force": true},
function (err, deletedFiles) {
console.log('Files deleted:\n', deletedFiles.join('\n'));
});
},
clean : function () {
return del(['rev-manifest-js.json',
'rev-manifest-css.json'],
{"force": true},
function (err, deletedFiles) {
console.log('Files deleted:\n', deletedFiles.join('\n'));
});
},
watch : function (model) {
var _name = model.name,
_resources = model.resources,
_dist = config.dist;
if (_name && typeof _resources === 'object')
require('./task/watch').create(_name, _resources, _dist);
}
}