我尝试同时编译公共和管理员的sass,我面对gulp文件的一些麻烦,也许有人可以弄清楚我错在哪里。
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var sass = require('gulp-sass');
// Static Server + watching scss/html files
gulp.task('serve', ['sass'], function() {
browserSync.init({
notify: false,
proxy: 'http://localhost/management_system/Job'
});
gulp.watch("scss/public/*.scss", ['sass']);
gulp.watch("scss/admin/*.scss", ['sass']);
gulp.watch('application/**/*.php').on('change', browserSync.reload);
});
// Compile sass into CSS & auto-inject into browsers for public
gulp.task('sass', function() {
return gulp.src("scss/public/*.scss")
.pipe(sass())
.pipe(gulp.dest("assets/public/css"))
.pipe(browserSync.stream());
});
// Compile sass into CSS & auto-inject into browsers for admin
gulp.task('sass', function() {
return gulp.src("scss/admin/*.scss")
.pipe(sass())
.pipe(gulp.dest("assets/admin/css"))
.pipe(browserSync.stream());
});
gulp.task('default', ['serve']);