ruby-on-railssassgulpgulp-ruby-sassgulp-plugin

The gulp plugin gulp-ruby-sass version 2.0.4 does not compile


The gulp plugin gulp-ruby-sass doesn't work "gulp-ruby-sass": "^2.0.4" for the compiler at the same time it does work with its own old version "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


Solution

  • The code was for old version of gulp-ruby-sass, new version 2.0.4 required another way for coding

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