-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathgulpfile.js
40 lines (35 loc) · 1.08 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
var gulp = require('gulp'),
header = require('gulp-header'),
uglify = require('gulp-uglify'),
cleanCSS = require('gulp-clean-css'),
rename = require('gulp-rename'),
package = require('./package.json'),
banner;
banner = [
'/*! ',
'<%= package.name %> ',
'v<%= package.version %> | ',
'(c) ' + new Date().getFullYear() + ' <%= package.author %> |',
' <%= package.homepage %>',
' */',
'\n'
].join('');
gulp.task('compress:js', function() {
return gulp.src('public/js/app.js')
.pipe(uglify())
.pipe(header(banner, { package : package }))
.pipe(rename("app.min.js"))
.pipe(gulp.dest('public/js/'));
});
gulp.task('compress:css', function() {
return gulp.src('public/css/style.css')
.pipe(cleanCSS())
.pipe(header(banner, { package : package }))
.pipe(rename("style.min.css"))
.pipe(gulp.dest('public/css/'));
});
gulp.task('watch', function () {
gulp.watch('public/js/app.js', ['compress:js']);
gulp.watch(['public/css/style.css'], ['compress:css']);
});
gulp.task('default', ['compress:js', 'compress:css']);