gulp插件gulp-ruby-sass版本2.0.4无法编译

时间:2015-10-13 16:51:04

标签: ruby-on-rails sass gulp gulp-ruby-sass gulp-plugin

gulp插件gulp-ruby-sass对于编译器不起作用"gulp-ruby-sass": "^2.0.4",同时它与自己的旧版本"gulp-ruby-sass": "^0.7.1"一起工作

var gulp = require('gulp'),
    sass = require('gulp-ruby-sass'),
    notify = require("gulp-notify"),
    bower = require('gulp-bower');
var config = {
    sassPath: './resources/sass',
    bowerDir: './bower_components'
};

gulp.task('css', function () {
    return gulp.src(config.sassPath + '/style.scss')
        .pipe(sass({
        loadPath: [
            './resources/sass',
        config.bowerDir + '/bootstrap-sass/assets/stylesheets',
        config.bowerDir + '/font-awesome/scss', ]
    })
    .on("error", notify.onError(function (error) {
        return "Error: " + error.message;
    })))
    .pipe(gulp.dest('./public/css'));
});

enter image description here

1 个答案:

答案 0 :(得分:2)

代码适用于 gulp-ruby-sass 的旧版本,新版本2.0.4需要另一种编码方式

gulp.task('css', function () {
    return sass(config.sassPath + '/style.scss', {
        precision: 6,
        stopOnError: true,
        cacheLocation: './',
        loadPath: [
            './resources/sass',
        config.bowerDir + '/bootstrap-sass/assets/stylesheets',
        config.bowerDir + '/font-awesome/scss', ]
    })
    .on("error", notify.onError(function (error) {
        return "Error: " + error.message;
    }))
    .pipe(gulp.dest('./public/css'));
});