Gulp TypeError:path.join的参数必须是字符串 [英] Gulp TypeError: Arguments to path.join must be strings

查看:329
本文介绍了Gulp TypeError:path.join的参数必须是字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的问题,大嘴红宝石。当我尝试运行 watch 任务并更改一些.sass文件时,它会发生错误:

  TypeError :path.join的参数必须是字符串

这是我的gulpfile.js

  var gulp = require('gulp'); 
var jade = require('gulp-jade');
var sass = require('gulp-ruby-sass');
var watch = require('gulp-watch');

gulp.task('sass',function(){
return gulp.src('sass / *。sass')
.pipe(sass())
.pipe(gulp.dest('./ css'));

});
gulp.task('watch',function(){
gulp.watch('./ sass / *。sass',['sass']);
})

我使用了gulp-slash,但它不起作用。

解决方案

使用语法更改 in gulp-ruby-sass 从1.0.0-alpha开始,您需要使用 gulp-ruby-sass()来代替 gulp.src()从文件或目录编译Sass。



如果您尝试使用原始语法与更新或最新版本,您可能会遇到以下错误:
$ b

TypeError:path.join的参数必须是字符串

  var gulp = require('gulp'); 
var sass = require('gulp-ruby-sass');
$ b $ // gulp-ruby-sass:0.7.1
gulp.task('sass',function(){
return gulp.src('path / to / scss ')
.pipe(sass({style:'expanded'}))
.pipe(gulp.dest('path / to / css'));
});

使用gulp-ruby-sass()作为吞食源适配器:
$ b

  // gulp-ruby-sass:1.x 
gulp.task ('sass',function(){
return sass('path / to / scss',{style:'expanded'})
.pipe(gulp.dest('path / to / css' ));
});

请注意return语句第一行的不同。



在使用gulp-ruby-sass 1.0.0-alpha时,请记住,在编写本文时,globs不受支持。

I have i problem with gulp-ruby-sass. When i try to run the watch task and change some .sass files it occurs error:

TypeError: Arguments to path.join must be strings 

Here is my gulpfile.js

var gulp = require('gulp');
var jade = require('gulp-jade');
var sass = require('gulp-ruby-sass');
var watch = require('gulp-watch');

gulp.task('sass', function() {
    return gulp.src('sass/*.sass')
        .pipe(sass())
                .pipe(gulp.dest('./css'));

});
gulp.task('watch', function() {
    gulp.watch('./sass/*.sass', ['sass']);
})

I used gulp-slash but it don't works.

解决方案

With the syntax changes in gulp-ruby-sass starting from 1.0.0-alpha, you'll need to use gulp-ruby-sass() instead of gulp.src() to compile your Sass from a file or directory.

If you try to use the original syntax with newer or latest versions, you may encounter the following error:

TypeError: Arguments to path.join must be strings

For example, the original syntax in 0.7.x and earlier using gulp.src(), now deprecated:

var gulp = require('gulp');
var sass = require('gulp-ruby-sass');

// gulp-ruby-sass: 0.7.1
gulp.task('sass', function() {
    return gulp.src('path/to/scss')
        .pipe(sass({ style: 'expanded' }))
        .pipe(gulp.dest('path/to/css'));
});

The new syntax introduced in 1.x using gulp-ruby-sass() as a gulp source adapter:

// gulp-ruby-sass: 1.x
gulp.task('sass', function() {
    return sass('path/to/scss', { style: 'expanded' })
        .pipe(gulp.dest('path/to/css'));
});

Notice the difference in the first line of the return statement.

Also keep in mind, as of this writing when using gulp-ruby-sass 1.0.0-alpha, globs are not supported yet.

这篇关于Gulp TypeError:path.join的参数必须是字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆