这是我网站项目中的gulpfile:
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
sass_path = 'src/style/*.scss';
gulp.task('watch', function() {
gulp.watch(sass_path, ['styles']);
});
gulp.task('styles', function() {
gulp.src(sass_path)
.pipe(sass())
.pipe(gulp.dest('dist'));
});
gulp.task('default', ['styles', 'watch']);
当我尝试运行gulp时,它会在完成任务'styles'之前中断,并给出输出:
[15:37:00] Starting 'styles'...
[15:37:00] 'styles' errored after 1.92 ms
[15:37:00] TypeError: Arguments to path.join must be strings
at path.js:360:15
at Array.filter (native)
at Object.exports.join (path.js:358:36)
at module.exports (/opt/lampp/htdocs/dev/lab/gulp/node_modules/gulp-ruby-sass/index.js:61:15)
at Gulp.<anonymous> (/opt/lampp/htdocs/dev/lab/gulp/Gulpfile.js:24:9)
at module.exports (/opt/lampp/htdocs/dev/lab/gulp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/opt/lampp/htdocs/dev/lab/gulp/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/opt/lampp/htdocs/dev/lab/gulp/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
at /opt/lampp/htdocs/dev/lab/gulp/node_modules/gulp/node_modules/orchestrator/index.js:279:18
at finish (/opt/lampp/htdocs/dev/lab/gulp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
我该如何解决?
答案 0 :(得分:4)
'gulp-ruby-sass'的语法改变了,现在是这样的:
gulp.task('styles', function() {
return sass('src/style')
.pipe(gulp.dest('dist'));
});