forked from pinceladasdaweb/mediabox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
43 lines (38 loc) · 1.18 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
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('src/mediabox.js')
.pipe(header(banner, { package : package }))
.pipe(gulp.dest('dist/'))
.pipe(rename({ suffix: '.min' }))
.pipe(uglify())
.pipe(header(banner, { package : package }))
.pipe(gulp.dest('dist/'));
});
gulp.task('compress:css', function() {
return gulp.src('src/mediabox.css')
.pipe(header(banner, { package : package }))
.pipe(gulp.dest('dist/'))
.pipe(rename({ suffix: '.min' }))
.pipe(cleanCSS())
.pipe(gulp.dest('dist/'));
});
gulp.task('watch', function () {
gulp.watch('src/mediabox.js', ['compress:js']);
gulp.watch('src/mediabox.css', ['compress:css']);
});
gulp.task('default', ['compress:js', 'compress:css']);