sass
構成でタスクを実行しようとしていますgulp-ruby-sass
が、これは私が得るエラーです(エラーの後に構成とコードが続きます):
[04:57:11] TypeError: undefined is not a function
at DestroyableTransform.Readable.pipe [as _pipe] (E:\Do\angular-jspm-todo\no
de_modules\gulp-autoprefixer\node_modules\through2\node_modules\readable-stream\
lib\_stream_readable.js:516:8)
at DestroyableTransform.pipe2 (E:\Do\angular-jspm-todo\node_modules\gulp-plu
mber\index.js:70:20)
at Gulp.<anonymous> (E:\Do\angular-jspm-todo\gulp\tasks\sass.js:15:8)
at module.exports (E:\Do\angular-jspm-todo\node_modules\gulp\node_modules\or
chestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (E:\Do\angular-jspm-todo\node_modules\gulp\nod
e_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (E:\Do\angular-jspm-todo\node_modules\gulp\nod
e_modules\orchestrator\index.js:214:10)
at E:\Do\angular-jspm-todo\node_modules\gulp\node_modules\orchestrator\index
.js:279:18
at finish (E:\Do\angular-jspm-todo\node_modules\gulp\node_modules\orchestrat
or\lib\runTask.js:21:8)
at module.exports (E:\Do\angular-jspm-todo\node_modules\gulp\node_modules\or
chestrator\lib\runTask.js:60:3)
at Gulp.Orchestrator._runTask (E:\Do\angular-jspm-todo\node_modules\gulp\nod
e_modules\orchestrator\index.js:273:3)
[04:57:11] gulp-ruby-sass stderr: OptionParser::InvalidOption: invalid option: -
-sourcemap-path=app/css
Use --trace for backtrace.
E:\Do\angular-jspm-todo\node_modules\gulp-autoprefixer\node_modules\through2\nod
e_modules\readable-stream\lib\_stream_readable.js:523
dest.end();
^
TypeError: undefined is not a function
at DestroyableTransform.onend (E:\Do\angular-jspm-todo\node_modules\gulp-aut
oprefixer\node_modules\through2\node_modules\readable-stream\lib\_stream_readabl
e.js:523:10)
at DestroyableTransform.g (events.js:199:16)
at DestroyableTransform.emit (events.js:129:20)
at E:\Do\angular-jspm-todo\node_modules\gulp-autoprefixer\node_modules\throu
gh2\node_modules\readable-stream\lib\_stream_readable.js:965:16
at process._tickCallback (node.js:355:11)
sass タスクの構成は次のようになります。
sass: {
src: app + '/scss/**/*.{sass,scss}',
dest: app + '/css',
options: {
noCache: true,
compass: false,
sourcemap: true,
sourcemapPath: app+'/css'
}
},
autoprefixer: {
browsers: [
'last 2 versions',
'safari 5',
'ie 8',
'ie 9',
'opera 12.1',
'ios 6',
'android 4'
],
cascade: true
},
scsslint: {
src: [
app + '/scss/**/*.{sass,scss}',
]
}
sass
タスクは次のとおりです。
gulp.task('sass',function(){
return sass(config.sass.src,config.sass.options)
.pipe(plumber({errorHandler:notify.onError('<%= error.message %>')}))
.pipe(sourcemaps.init())
.pipe(autoprefixer(config.autoprefixer))
.pipe(filter)
.pipe(sourcemaps.write('.',{includeContent:false}))
.pipe(filter.restore())
.pipe(gulp.dest(config.sass.dest));
});
これは私のscsslint
仕事です:
var gulp = require('gulp');
var scsslint = require('gulp-scss-lint');
var config = require('../config').scsslint;
gulp.task('scsslint',function(){
return gulp.src(config.src)
.pipe(scsslint(config.options))
});
browser-sync
私はそれらをタスクのために実行しwatch
ます:
gulp.task('serve',['jshint','scsslint','sass'],function(){
browserSync(config);
});
gulp.task('watch',['serve'],function(){ gulp.watch(config.jshint,['jshint']); gulp.watch(config.sass,['scsslint','sass'] ); });