0
好的。我有這個代碼的麻煩。我之前使用過gulp-ruby-sass,但直到現在我還沒有遇到過這種錯誤。我正在使用gulp-ruby-sass 1.0.0。我只是試圖使用gulp-ruby-sass在css中運行我的sass文件。但是,這顯然不起作用。任何建議,將不勝感激。使用.pipe(sass({style:'expanded'))時,gulp-ruby-sass TypeError
這裏的錯誤:
TypeError: string is not a function
at Gulp.<anonymous> (/Users/xxxxxxxxxxx/xxxx/xxxxxxx/gulpfile.js:22:15)
at module.exports (/Users/xxxxxxxxxxx/xxxx/xxxxxxxx/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/Users/xxxxxxxxxxx/xxxx/xxxxxxx/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/Users/xxxxxxxxxxx/xxxx/xxxxxxx/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
at Gulp.Orchestrator.start (/Users/xxxxxxxxxxx/xxxx/xxxxxxx/node_modules/gulp/node_modules/orchestrator/index.js:134:8)
at /usr/local/lib/node_modules/gulp/bin/gulp.js:129:20
at process._tickCallback (node.js:442:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:929:3
我使用了我的項目咕嘟咕嘟代碼如下:
var gulp = require('gulp'),
sass = ('gulp-ruby-sass'),
uglify = require('gulp-uglify'),
livereload = require('gulp-livereload'),
plumber = require('gulp-plumber'),
jshint = require('gulp-jshint');
var paths = {
sass: 'stylesheets/scss/',
css: 'stylesheets/css'
};
gulp.task('lint', function() {
return gulp.src('angular/app.js')
.pipe(jshint())
.pipe(jshint.reporter());
});
gulp.task('sass', function() {
return gulp.src(paths.sass + '*.scss')
.pipe(plumber())
.pipe(sass({style: 'expanded'})) // HERE IS WHERE THE ERROR OCCURS
.pipe(gulp.dest(paths.css + '*.css'))
.pipe(livereload());
});
gulp.task('scripts', function() {
return gulp.src('angular/app.js')
.pipe(plumber())
.pipe(uglify())
.pipe(gulp.dest('angular/minjs'))
.pipe(livereload());
});
gulp.task('watch', function() {
livereload.listen();
gulp.watch(paths.sass + '*.scss', ['sass']);
gulp.watch('angular/app.js', ['scripts']);
});
gulp.task('default', ['lint', 'sass', 'scripts', 'watch']);