-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
40 lines (29 loc) · 956 Bytes
/
gulpfile.js
File metadata and controls
40 lines (29 loc) · 956 Bytes
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');
var sass = require('gulp-sass');
var watch = require('gulp-watch');
var sourcemaps = require('gulp-sourcemaps');
var tinypng = require('gulp-tinypng-compress');
gulp.task("tinypng", function(){
gulp.src('./static/images/src/*.{png,jpg,jpeg}')
.pipe(tinypng({
key: 'KW8hT5AMx05TI9DVXLx_hoQOD7BDU1OM',
sigFile: 'images/.tinypng-sigs',
log: true
})).on('error', function(err) {
console.error(err.message);
})
.pipe(gulp.dest('./static/images'));
});
gulp.task('sassfile',function(){
return gulp.src('./static/css/src/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'compressed'
}))
.pipe(sourcemaps.write())
.pipe( gulp.dest( './static/css' ) );
});
gulp.task('default', function() {
// 将你的默认的任务代码放在这
gulp.watch('./static/css/src/*.scss', ['sassfile']);
});