-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
46 lines (39 loc) · 1.24 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
// Less configuration
var gulp = require('gulp');
var bundle = require('gulp-bundle-assets');
var rimraf = require('gulp-rimraf');
var publicRoot = "./wwwroot";
var dirMaps = publicRoot + "/maps"
var scriptsSrc = 'Content/js';
var scriptsDst = publicRoot;
// clean up destination directory before bundling and copying new stuff
gulp.task('clean', function () {
return gulp.src(publicRoot+'/**/*.{js,css,map}', { read: false })
.pipe(rimraf());
});
// minify and bundle stuff
gulp.task('bundle', ['clean'], function() {
gulp.src('./bundle.config.js')
.pipe(bundle())
.pipe(bundle.results({
dest: '.', // destination of the bundle.result.json
pathPrefix: '/' // prefix for each path in bundle.result.json
}))
.pipe(gulp.dest(publicRoot)); // destination of the bundle files
});
// watch for changes
gulp.task('watch', ['bundle'], function() {
gulp.watch(
[
'Sections/**/Content/less/*.less',
'Sections/**/Content/css/*.css',
'Sections/**/Content/fonts/*.*',
'Sections/**/Content/img/*.*',
'Sections/**/Content/js/*.js',
'Sections/**/Content/js/**/*.js'
],
['bundle']
);
});
// do stuff and then start watching to to stuff, when it is needed again
gulp.task('default', ['watch']);