-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
50 lines (42 loc) · 1.31 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
var gulp = require('gulp'),
connect = require('gulp-connect'),
concat = require('gulp-concat'),
sass = require('gulp-sass'),
minifycss = require('gulp-minify-css'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
notify = require('gulp-notify'),
autoprefixer = require('gulp-autoprefixer'),
port = process.env.port || 5100;
//live reload
gulp.task('connect',function(){
connect.server({
root:'./',
port:port,
livereload:true,
})
});
// sass
gulp.task('scss',function(){
gulp.src('./_sass/*.scss')
.pipe(sass({ style: 'expanded' }))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(gulp.dest('static/css'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('./static/css/'))
.pipe( connect.reload() )
.pipe(notify({ message: 'Styles task complete' }));
});
// html
gulp.task('html',function(){
gulp.src('./**.html')
.pipe( connect.reload() )
.pipe(notify({ message: 'html task complete' }));
});
gulp.task('watch',function(){
gulp.watch('./_sass/*.scss',['scss']);
gulp.watch('./**.html',['html']);
});
gulp.task('default',['watch']);
gulp.task('serve',['connect','watch']);