审查视图

1  
朱振飞 authored
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
/**
 * gulp.files
 * 
 * @authors Your Name (you@example.org)
 * @date    2017-08-22 17:30:49
 * @version $Id$
 */

var gulp = require('gulp');
var browserSync = require('browser-sync').create();

gulp.task('server',function() {
    browserSync.init({
        server: {
            baseDir: './'
        }
    })
    gulp.watch(`*.html`).on('change', browserSync.reload);
    gulp.watch(`js/*.js`).on('change', browserSync.reload);
    gulp.watch(`css/*.css`).on('change', browserSync.reload);
})


gulp.task('stylus', function() {
    return gulp.src(filePath.css.src())
        .pipe(stylus({
            compress: true,
            use: nib()
        }))
        .pipe(gulp.dest(filePath.css.dest()))
        .pipe(browserSync.stream())
})

gulp.task('stylus:watch', ['stylus'], browserSync.reload())


gulp.task('babel', function() {
    mod = argv.m;
    return gulp.src(filePath.js.src())
        .pipe(babel({
            presets: ['es2015']
        }))
        .pipe(gulp.dest(filePath.js.dest()));
})

gulp.task('babel:watch', ['babel'], browserSync.reload())