-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
55 lines (47 loc) · 1.81 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
'use strict';
var src = require('./tasks/folder-names/src.js'),
dist = require('./tasks/folder-names/dist.js'),
gulp = require('gulp'),
plugins = require('gulp-load-plugins')();
// Wiring non-gulp modules to be used as plugins
plugins.del = require('del');
plugins.path = require('path');
plugins.mainBowerFiles = require('main-bower-files');
plugins.runSequence = require('run-sequence');
plugins.glob = require('glob').sync;
plugins.es = require('event-stream');
function getTask(task) {
return require('./tasks/' + task)(gulp, plugins, src, dist);
}
gulp.task('clean-dist', getTask('clean-dist'));
gulp.task('compile-sass', getTask('compile-sass'));
gulp.task('copy-library', getTask('copy-library'));
gulp.task('copy-scripts', getTask('copy-scripts'));
gulp.task('copy-css', ['compile-sass'], getTask('copy-css'));
gulp.task('copy-partials', getTask('copy-partials'));
gulp.task('copy-assets', getTask('copy-assets'));
gulp.task('copy-index-html', getTask('copy-index-html'));
gulp.task('inject-files', getTask('inject-files'));
gulp.task('build-dist',function(done){
plugins.runSequence(
'clean-dist',
['copy-scripts', 'copy-css', 'copy-library', 'copy-partials', 'copy-index-html','copy-assets'],
'inject-files',
done
)
});
gulp.task('watch',function(){
gulp.watch(plugins.path.join(src.base, '**', '*.scss'), ['copy-css']);
gulp.watch(plugins.path.join(src.base, '**', '*.js'),['copy-scripts']);
gulp.watch(plugins.path.join(src.base, '**', '*.html'), function(){
plugins.runSequence(['copy-partials', 'copy-index-html'], 'inject-files');
});
gulp.watch(plugins.path.join(src.base, '**', '!(*.js|*.html|*.css|*.scss)'),['copy-assets']);
});
gulp.task('serve-dist', function(done){
require('./server');
done();
});
gulp.task('default',function(done){
plugins.runSequence('build-dist', 'watch', 'serve-dist', done);
});