-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
48 lines (41 loc) · 1.12 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
var gulp = require('gulp');
var stylus = require('gulp-stylus');
var browserSync = require('browser-sync');
var autoprefixer = require('autoprefixer-stylus');
var minifyCss = require('gulp-minify-css');
var gulpStylint = require('gulp-stylint');
var reload = browserSync.reload;
var del = require('del');
gulp.task('clean', function(){
return del(['build']);
});
gulp.task('browser-sync', function(){
browserSync({
server:{
baseDir: ""
}
})
});
gulp.task('refresh-browser', function(){
reload({stream:true});
})
gulp.task('compile-css', ['clean'], function(){
return gulp.src('./css/style.styl')
.pipe(gulpStylint())
.pipe(gulpStylint.reporter())
.pipe(stylus({
use: [autoprefixer()]
}))
.pipe(gulp.dest('./css/build'))
.pipe(reload({stream:true}));
});
gulp.task('dist', function(){
return gulp.src('./css/build/style.css')
.pipe(minifyCss())
.pipe(gulp.dest('./css/build/'));
});
gulp.task('watch', function(){
gulp.watch('./css/style.styl', ['compile-css', 'dist']);
gulp.watch('./index.html', ['browser-sync']);
});
gulp.task('default', ['browser-sync', 'watch']);