-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
40 lines (37 loc) · 1.46 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');
//jade->html
var jade = require('gulp-jade');
gulp.task('testJade', function() {
gulp.src('src-dev/*.jade')
.pipe(jade({pretty:true}))
.pipe(gulp.dest('./'));
});
//stylus->css
var stylus = require('gulp-stylus'),
nib = require('nib'),
autoprefixer = require('gulp-autoprefixer'),
cssmin = require('gulp-clean-css');
gulp.task('testStylus', function(){
var options1 = {
browsers: ['last 4 versions', 'Android >= 4.0'],
cascade: true, //是否美化属性值 默认:true 像这样:
//-webkit-transform: rotate(45deg);
// transform: rotate(45deg);
remove:true //是否去掉不必要的前缀 默认:true
};
var options2 = {
advanced: false,//类型:Boolean 默认:true [是否开启高级优化(合并选择器等)]
compatibility: 'ie8',//保留ie7及以下兼容写法 类型:String 默认:''or'*' [启用兼容模式; 'ie7':IE7兼容模式,'ie8':IE8兼容模式,'*':IE9+兼容模式]
keepBreaks: true//类型:Boolean 默认:false [是否保留换行]
};
gulp.src('src-dev/css/*.styl')
.pipe(stylus({error: true, use: [nib()]}))
.pipe(autoprefixer(options1))
.pipe(cssmin(options2))
.pipe(gulp.dest('css/'));
});
gulp.task('watch', function() {
gulp.watch('**/*.jade', ['testJade']);
gulp.watch('src-dev/css/*.styl', ['testStylus']);
});
gulp.task('default', ['watch']);