/**
* Created by Administrator on 2017/8/23.
*/
const gulp = require("gulp"),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
connect = require('gulp-connect'),
livereload = require('gulp-livereload');
// sass
gulp.task('sass', () => {
return gulp.src('static/sass/*.scss')
.pipe(sass().on("error", sass.logError))
.pipe(autoprefixer('last 6 version'))
.pipe(cssnano())
.pipe(gulp.dest('static/css'));
});
// watch
gulp.task('watch', () => {
gulp.watch("static/sass/*.scss", ["sass"]);
});
// http-server
gulp.task('connect', () => {
connect.server({
port: 8090,
livereload: true
});
});
// hot-livereload chromex 下载livereload插件
gulp.task('hot', () => {
livereload.listen();
gulp.watch('./**/*.*', (event) => {
livereload.changed(event.path);
});
});
gulp.task('default', ['watch', 'connect', 'hot']);