1

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'));
});

在此处输入图像描述

4

1 回答 1

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'));
});
于 2015-10-14T08:11:30.710 回答