forked from 2gis/makeup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
70 lines (53 loc) · 1.91 KB
/
gulpfile.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
var gulp = require('gulp');
var args = require('yargs').argv;
var connect = require('gulp-connect');
var runSequence = require('run-sequence');
var mocha = require('gulp-mocha');
var config = require('./config.js');
var del = require('del');
var buildOptions = {
release: 'r' in args || 'release' in args,
noJquery: 'noJquery' in args
};
gulp.task('default', function() {
return gulp.start('dev');
});
gulp.task('d', ['dev']);
gulp.task('dev', function(callback) {
return runSequence('build', 'connect', 'watch', callback);
});
gulp.task('build', function(callback) {
return runSequence('templates', 'js', 'sprite', 'css', callback);
});
gulp.task('clean', function(callback) {
del(['dist/*', 'temp/*'], callback);
});
gulp.task('t', ['jshint', 'unit']);
gulp.task('test', ['unit']);
gulp.task('watch', function(callback) {
// Templates
gulp.watch('./source/templates/*.html', ['templates', 'js']);
// Scripts
gulp.watch('./source/blocks/**/*.js', ['js']);
gulp.watch('./source/js/**/*.js', ['js']);
gulp.watch('./source/jsPartials/**/*.js', ['js']);
// Images
gulp.watch('./source/images/**/*.{jpg,jpeg,gif,png}', ['img']);
gulp.watch('./source/svg/**/*.svg', ['sprite', 'css']);
// Styles
gulp.watch('./source/blocks/**/*.less', ['css']);
gulp.watch('./source/less/**/*.less', ['css']);
});
gulp.task('connect', function() {
connect.server({
root: __dirname + '/' + config.root,
port: config.port
});
});
gulp.task('templates', require('./tasks/templates')(buildOptions));
gulp.task('js', require('./tasks/scripts')(buildOptions));
gulp.task('img', require('./tasks/images')(buildOptions));
gulp.task('sprite', require('./tasks/sprite')(buildOptions));
gulp.task('css', require('./tasks/styles')(buildOptions));
gulp.task('css', require('./tasks/styles')(buildOptions));
gulp.task('test', require('./tasks/tests')(buildOptions));