-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
executable file
·44 lines (41 loc) · 1.31 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
var gulp = require('gulp');
var cleanCSS = require('gulp-clean-css');
var jsmin = require('gulp-jsmin');
//css minification
gulp.task('minify-css', function () {
return gulp.src('public/css/development/style.css')
.pipe(cleanCSS({debug: true}, function(details) {
console.log(details.name + ': ' + details.stats.originalSize);
console.log(details.name + ': ' + details.stats.minifiedSize);
}))
.pipe(gulp.dest('public/css/production/'));
});
//js minification
gulp.task('minify-js', function () {
gulp.src('public/js/development/script.js')
.pipe(jsmin())
.pipe(gulp.dest('public/js/production/'));
});
gulp.task('default',function(){
/*
* run the default task through gulp command
* */
gulp.run('minify-css');
gulp.run('minify-js');
/*
* watcher added so if there's a change
* in any css within development directory
* gulp'll watch & fire minification
* */
//gulp.watch('public/css/development/*.css',function(){
// gulp.run('minify-css')
// });
/*
* watcher added so if there's a change
* in any js within development directory
* gulp'll watch & fire minification
* */
//gulp.watch('public/js/development/*.js',function(){
// gulp.run('minify-js')
//});
});