加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
gulpfile.js 2.13 KB
一键复制 编辑 原始数据 按行查看 历史
durban.zhang 提交于 2015-04-09 21:00 . 完善整体目录架构
var gulp = require('gulp'),
browserSync = require('browser-sync'),
gulpLoadPlugins = require('gulp-load-plugins'),
plugins = gulpLoadPlugins();
gulp.task('minify',function(){
gulp.src('public/javascripts/*.js')
.pipe(plugins.uglify())
.pipe(gulp.dest('public/js'))
});
gulp.task('js',function(){
return gulp.src('public/javascripts/*.js')
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('default'))
.pipe(plugins.uglify())
.pipe(plugins.concat('app.js'))
.pipe(gulp.dest('public/js'))
});
gulp.task('shell',plugins.shell.task(['npm start']));
//监测coffee文件变化
gulp.task('coffee',function(){
gulp.src('public/coffee/*.coffee')
.pipe(plugins.watch('public/coffee/*.coffee'))
.pipe(plugins.coffee({bare:true}).on('error',plugins.util.log))
.pipe(gulp.dest('public/js'))
.pipe(plugins.livereload())
});
//监测less文件变化
gulp.task('less',function(){
gulp.src('public/stylesheets/*.less')
.pipe(plugins.watch('public/stylesheets/*.less'))
.pipe(plugins.less())
.pipe(gulp.dest('public/css'))
.pipe(plugins.livereload())
});
//监测sass文件变化
gulp.task('sass',function(){
gulp.src('public/sass/**/*.scss')
.pipe(plugins.watch('public/sass/**/*.scss'))
.pipe(plugins.sass({'outputStyle':'compressed'}))
.pipe(gulp.dest('public/css'))
.pipe(plugins.livereload());
});
//监测react变化
gulp.task('react',function(){
gulp.src('public/react/**/*.jsx')
.pipe(plugins.react())
.pipe(gulp.dest('public/js'))
});
//browserSync 检测文件变化
gulp.task('serve',['less','sass','react','coffee','js'],function(){
var config = {
port:3002,
proxy:'127.0.0.1:3030',
files:['views/**/*.ejs','lib/**/*.js','routes/**/*.js','config/**/*.js']
};
browserSync(config);
gulp.watch('./public/js/**/*.js',['js'],browserSync.reload());
gulp.watch('./public/js/**/*.jsx',['react'],browserSync.reload());
gulp.watch('./public/coffee/**/*.coffee',['coffee'],browserSync.reload());
gulp.watch('./public/sass/**/*.scss',['sass'],browserSync.reload());
gulp.watch('./public/stylesheets/**/*.less',['less'],browserSync.reload());
});
gulp.task('default',['shell','serve'],function(){
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化