error:
gulp serve
[09:35:04] Working directory changed to F:\new-gulp-test [09:35:05] Using gulpfile F:\new-gulp-test\gulpfile.js [09:35:05] Starting 'sass'... [09:35:05] 'sass' errored after 8.94 ms [09:35:05] TypeError: glob pattern string required at new Minimatch (F:\new-gulp-test\node_modules\gulp-ruby-sass\node_modules\glob\node_modules\minimatch\minimatch.js:108:11) at setopts (F:\new-gulp-test\node_modules\gulp-ruby-sass\node_modules\glob\common.js:112:20) at new GlobSync (F:\new-gulp-test\node_modules\gulp-ruby-sass\node_modules\glob\sync.js:38:3) at Function.globSync [as sync] (F:\new-gulp-test\node_modules\gulp-ruby-sass\node_modules\glob\sync.js:24:10) at F:\new-gulp-test\node_modules\gulp-ruby-sass\index.js:68:21 at Array.forEach (native) at gulpRubySass (F:\new-gulp-test\node_modules\gulp-ruby-sass\index.js:67:10) at Gulp.<anonymous> (F:\new-gulp-test\gulpfile.js:59:15) at module.exports (F:\new-gulp-test\node_modules\.npminstall\orchestrator\0.3.7\orchestrator\lib\runTask.js:34:7) at Gulp.Orchestrator._runTask (F:\new-gulp-test\node_modules\.npminstall\orchestrator\0.3.7\orchestrator\index.js:273:3)
gulpfile.js
var minifycss = require('gulp-minify-css'),// CSS压缩 uglify = require('gulp-uglify'),// js压缩 concat = require('gulp-concat'),// 合并文件 rename = require('gulp-rename'),// 重命名 clean = require('gulp-clean');//清空文件夹 var gulp = require('gulp'), sass = require('gulp-ruby-sass'), filter = require('gulp-filter'); notify = require('gulp-notify'), plumber = require('gulp-plumber'); browserSync = require('browser-sync').create(), reload = browserSync.reload; gulp.task('serve', ['sass'], function() { browserSync.init({ server: "./stc" }); gulp.watch("stc/scss/*.scss", ['sass']); gulp.watch("stc/*.html").on('change', reload); }); gulp.task('sass', function() { return gulp.src(['stc/scss/*.scss','!stc/scss/extend/{reset,test}.scss']) .pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')})) .pipe(sass({sourcemap: true})) .pipe(gulp.dest('stc/css'))// Write the CSS & Source maps 59行 .pipe(filter('**/*.css')) // Filtering stream to only css files .pipe(browserSync.reload({stream:true})); }); gulp.task('default', ['serve']);
这个是什么错,谁知道?
又闹,是不是又不好好看文档了,人家哪是你那么用的,怎么着也得是这样啊:
gulp.task('sass', function() {
return sass(['stc/scss/*.scss','!stc/scss/extend/{reset,test}.scss'], {sourcemap: true})
.pipe(gulp.dest('stc/css'))// Write the CSS & Source maps 59行
.pipe(filter('**/*.css')) // Filtering stream to only css files
.pipe(browserSync.reload({stream:true}));
});
来,我们仔细看看文档: