-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
58 lines (50 loc) · 1.33 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
56
57
58
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
gulp.task('scripts', function() {
return gulp
.src('src/**/*.js')
.pipe(gulp.dest('dist'))
.pipe(plugins.rename(function (path) {
path.basename += ".min";
}))
.pipe(plugins.uglify())
.pipe(gulp.dest('dist'))
.pipe(plugins.gzip())
.pipe(gulp.dest('dist'))
;
});
gulp.task('styles', function() {
return gulp
.src('src/**/*.scss')
.pipe(plugins.sass({
errLogToConsole: true
}))
.pipe(plugins.autoprefixer(["last 3 versions", "> 1%"], { cascade: true }))
.pipe(gulp.dest('dist'))
.pipe(plugins.rename(function (path) {
path.basename += ".min";
}))
.pipe(plugins.minifyCss())
.pipe(gulp.dest('dist'))
.pipe(plugins.gzip())
.pipe(gulp.dest('dist'))
;
});
gulp.task('install', function() {
return gulp.src(['./package.json']).pipe(plugins.install());
});
gulp.task('clean', function(callback) {
var del = require('del');
return del(['dist/**/*'], callback);
});
gulp.task('default', ['clean', 'install'], function(callback) {
var runSequence = require('run-sequence');
runSequence(
['scripts', 'styles'],
callback
);
});
gulp.task('watch', ['default'], function() {
gulp.watch(['src/**/*.js'], ['scripts']);
gulp.watch(['src/**/*.scss'], ['styles']);
});