-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
57 lines (50 loc) · 1.55 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
var gulp = require('gulp');
var gulpCssnano = require('gulp-cssnano');
var gulpPlumber = require('gulp-plumber');
var gulpConnect = require('gulp-connect');
var gulpSass = require('gulp-sass');
var postcss = require('gulp-postcss');
//var px2rem = require('postcss-px2rem');
var autoprefixer = require('gulp-autoprefixer');
gulp.task('sass', function () {
//var processors = [px2rem({remUnit: 75})];
return gulp.src('./sass/*.scss')
.pipe(gulpSass().on('error', gulpSass.logError))
//.pipe(postcss(processors))
.pipe(autoprefixer({
browsers: ["ie 8", "Chrome > 20", "Firefox > 5"],
cascade: false
}))
.pipe(gulp.dest('./'));
});
gulp.task('css', ['sass'], function () {
return gulp.src(['./*.css'])
.pipe(gulpPlumber())
.pipe(gulpCssnano())
.pipe(gulp.dest('./build/'));
});
gulp.task('font', function () {
return gulp.src('./font/*.+(eot|svg|ttf|woff)')
.pipe(gulp.dest('./build/font/'));
});
gulp.task('html', function () {
return gulp.src('*.html')
.pipe(gulp.dest('./build/'));
});
gulp.task('default', ['css', 'font', 'html'], function () {
//return gulp.src('./**');
// .pipe(gulp.dest(config.release));
});
gulp.task('watch', function () {
// livereload.listen();
gulp.watch('./sass/*.scss', ['css']);
//gulp.watch('*.css', ['css']);
gulp.watch('*.html', ['html']);
});
//启动一个本地调试服务器
gulp.task('server', function () {
gulpConnect.server({
root: '',
port: 8000
});
});