gulp 插件gulp-ruby-sass在编译 sass 文件时不起作用。
'使用严格'; var path = require('path'); var gulp = require('gulp'); var conf = require('./conf'); var browserSync = require('浏览器同步'); var $ = require('gulp-load-plugins')(); varwiredep = require('wiredep').stream; var _ = 要求('lodash'); gulp.task('styles-reload', ['styles'], function() { 返回 buildStyles() .pipe(browserSync.stream()); }); gulp.task('样式', function() { 返回 buildStyles(); }); var buildStyles = function() { var sassOptions = { 风格:“扩展” }; var injectFiles = gulp.src([ path.join(conf.paths.src, '/app/**/*.scss'), path.join('!' + conf.paths.src, '/app/index.scss') ],{ 读:假 }); 变量注入选项 = { 转换:函数(文件路径){ filePath = filePath.replace(conf.paths.src + '/app/', ''); return '@import "' + 文件路径 + '";'; }, starttag: '// 注射器', endtag: '// endinjector', 添加根斜线:假 }; var cssFilter = $.filter('**/*.css', { restore: true }); 返回 gulp.src([ path.join(conf.paths.src, '/app/index.scss') ]) .pipe($.inject(injectFiles, injectOptions)) .pipe(wiredep(_.extend({}, conf.wiredep))) .pipe($.rubySass(sassOptions)).on('error', conf.errorHandler('RubySass')) .pipe(cssFilter) .pipe($.sourcemaps.init({ loadMaps: true })) .pipe($.autoprefixer()).on('error', conf.errorHandler('Autoprefixer')) .pipe($.sourcemaps.write()) .pipe(cssFilter.restore) .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app/'))); };
TypeError:需要全局模式字符串 在新的 Minimatch (/home/john/sac_srvs/new_srvs/sachin/node_modules/gulp-ruby-sass/node_modules/glob/node_modules/minimatch/minimatch.js:108:11) 在 setopts (/home/john/sac_srvs/new_srvs/sachin/node_modules/gulp-ruby-sass/node_modules/glob/common.js:112:20) 在新的 GlobSync (/home/john/sac_srvs/new_srvs/sachin/node_modules/gulp-ruby-sass/node_modules/glob/sync.js:38:3) 在 Function.globSync [同步] (/home/john/sac_srvs/new_srvs/sachin/node_modules/gulp-ruby-sass/node_modules/glob/sync.js:24:10) 在/home/john/sac_srvs/new_srvs/sachin/node_modules/gulp-ruby-sass/index.js:68:21 在 Array.forEach (本机) 在 Object.gulpRubySass (/home/john/sac_srvs/new_srvs/sachin/node_modules/gulp-ruby-sass/index.js:67:10) 在 buildStyles (/home/john/sac_srvs/new_srvs/sachin/gulp/styles.js:50:13) 在 Gulp.sassOptions.style (/home/john/sac_srvs/new_srvs/sachin/gulp/styles.js:20:10) 在 module.exports (/home/john/sac_srvs/new_srvs/sachin/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7) 在 Gulp.Orchestrator._runTask (/home/john/sac_srvs/new_srvs/sachin/node_modules/gulp/node_modules/orchestrator/index.js:273:3) 在 Gulp.Orchestrator._runStep (/home/john/sac_srvs/new_srvs/sachin/node_modules/gulp/node_modules/orchestrator/index.js:214:10) 在 Gulp.Orchestrator.start (/home/john/sac_srvs/new_srvs/sachin/node_modules/gulp/node_modules/orchestrator/index.js:134:8) 在 /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20 在 process._tickCallback (node.js:415:13) 在 Function.Module.runMain (module.js:499:11)