Created
May 7, 2015 10:47
-
-
Save alphatr/8e614063ca3df506e429 to your computer and use it in GitHub Desktop.
scss + gulp + browser-sync 开发,gulpfile 文件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var gulp = require('gulp'); | |
var browserSync = require('browser-sync'); | |
var reload = browserSync.reload; | |
var plugins = require('gulp-load-plugins')(); | |
var path = { | |
staticPath: './src/static', | |
viewPath: './src' | |
}; | |
/* sass */ | |
gulp.task('sass', function() { | |
return gulp.src(path.staticPath + '/sass/**/*.scss') | |
.pipe(plugins.sass({errLogToConsole: true})) | |
.pipe(plugins.autoprefixer()) | |
.pipe(gulp.dest(path.staticPath + '/css')) | |
.pipe(reload({stream:true})); | |
}); | |
/* browserSync */ | |
gulp.task('browserSync', function () { | |
browserSync({ | |
server: path.viewPath | |
}); | |
gulp.watch(path.viewPath + "/*.html").on('change', reload); | |
}); | |
/* default */ | |
gulp.task('default', ['browserSync'], function(){ | |
gulp.watch(path.staticPath + '/sass/**/*.scss', ['sass']); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment