gulp-ruby-sass

Compile Sass to CSS with Ruby Sass

gulp-ruby-sass

Compiles Sass with the Sass gem and pipes the results into a gulp stream.
To compile Sass with libsass, use gulp-sass

$ npm install --save-dev gulp-ruby-sass

Requires Sass >=3.4.

Use gulp-ruby-sass instead of gulp.src to compile Sass files.

var gulp = require('gulp');
var sass = require('gulp-ruby-sass');
 
gulp.task('sass', function () {
  return sass('source/')
    .on('error', sass.logError)
    .pipe(gulp.dest('result'));
});

Type: String

A directory or file to compile. Note gulp-ruby-sass does not use globs. It only accepts the input values that Ruby Sass accepts.

Type: Object

An object containing plugin and Sass options. Available options include:

Type: Boolean
Default: false

Run Sass with bundle exec.

Type: Boolean
Default: false

Initialize and pass Sass sourcemaps to gulp-sourcemaps. Note this option replaces Sass's sourcemap option.

var gulp = require('gulp');
var sass = require('gulp-ruby-sass');
var sourcemaps = require('gulp-sourcemaps');
 
gulp.task('sass', function () {
  return sass('source', {sourcemap: true})
    .on('error', sass.logError)
 
    // For inline sourcemaps 
    .pipe(sourcemaps.write())
 
    // For file sourcemaps 
    .pipe(sourcemaps.write('maps', {
      includeContent: false,
      sourceRoot: 'source'
    }))
 
    .pipe(gulp.dest('result'));
});

Type: String
Default: the system temp directory as reported by os-tempDir

This plugin compiles Sass files to a temporary directory before pushing them through the stream. Use tempDir to choose an alternate directory if you aren't able to use the default OS temporary directory.

Type: Boolean
Default: false

Emit a gulp error when Sass compilation fails.

Type: Boolean
Default: false

Log the spawned Sass or Bundler command. Useful for debugging.

Any additional options are passed directly to the Sass executable. The options are camelCase versions of Sass's options parsed by dargs.

Run sass -h for a complete list of Sass options.

gulp.task('sass', function () {
  return sass('source/', {
      precision: 6,
      stopOnError: true,
      cacheLocation: './',
      loadPath: [ 'library', '../../shared-components' ]
    })
    .on('error', sass.logError)
    .pipe(gulp.dest('result'));
});

This plugin wraps the Sass gem for the gulp build system. It does not alter Sass's output in any way. Any issues with Sass output should be reported to the Sass issue tracker.

gulp-ruby-sass doesn't support Sass caching or incremental builds yet (issue).

MIT © Sindre Sorhus