Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

gulp-dart-sass

mattdsteele147.1kMIT1.1.0TypeScript support: definitely-typed

Gulp plugin for sass

gulpplugin, sass, gulp

readme

gulp-dart-sass Build Status Join the chat at https://gitter.im/mattdsteele/gulp-dart-sass npm version

Sass plugin for Gulp, using the Dart Sass compiler.

Support

Only Active LTS and Current releases are supported.

Install

npm install gulp-dart-sass --save-dev

Basic Usage

Something like this will compile your Sass files:

'use strict';

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

gulp.task('sass', function () {
  return gulp.src('./sass/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('./css'));
});

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

You can also compile synchronously, doing something like this:

'use strict';

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

gulp.task('sass', function () {
  return gulp.src('./sass/**/*.scss')
    .pipe(sass.sync().on('error', sass.logError))
    .pipe(gulp.dest('./css'));
});

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

Options

Pass in options just like you would for node-sass; they will be passed along just as if you were using dart-sass. Except for the data option which is used by gulp-dart-sass internally. Using the file option is also unsupported and results in undefined behaviour that may change without notice.

For example:

gulp.task('sass', function () {
 return gulp.src('./sass/**/*.scss')
   .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
   .pipe(gulp.dest('./css'));
});

Source Maps

gulp-dart-sass can be used in tandem with gulp-sourcemaps to generate source maps for the Sass to CSS compilation. You will need to initialize gulp-sourcemaps prior to running gulp-dart-sass and write the source maps after.

var sourcemaps = require('gulp-sourcemaps');

gulp.task('sass', function () {
 return gulp.src('./sass/**/*.scss')
  .pipe(sourcemaps.init())
  .pipe(sass().on('error', sass.logError))
  .pipe(sourcemaps.write())
  .pipe(gulp.dest('./css'));
});

By default, gulp-sourcemaps writes the source maps inline in the compiled CSS files. To write them to a separate file, specify a path relative to the gulp.dest() destination in the sourcemaps.write() function.

var sourcemaps = require('gulp-sourcemaps');
gulp.task('sass', function () {
 return gulp.src('./sass/**/*.scss')
  .pipe(sourcemaps.init())
  .pipe(sass().on('error', sass.logError))
  .pipe(sourcemaps.write('./maps'))
  .pipe(gulp.dest('./css'));
});

Issues

gulp-dart-sass is a very light-weight wrapper around dart-sass, which is a port of Sass. Because of this, the issue you're having likely isn't a gulp-dart-sass issue, but an issue with one of those projects.

If you have a feature request/question how Sass works/concerns on how your Sass gets compiled/errors in your compiling, it's likely a dart-sass or Sass issue and you should file your issue with one of those projects.

If you're having problems with the options you're passing in, it's likely a dart-sass or libsass issue and you should file your issue with one of those projects.

We may, in the course of resolving issues, direct you to one of these other projects. If we do so, please follow up by searching that project's issue queue (both open and closed) for your problem and, if it doesn't exist, filing an issue with them.

changelog

Gulp Sass Changelog

v3.2.0

March 11, 2018

https://github.com/dlmanning/gulp-sass/releases/tag/v3.2.0

v3.0.0

January 9, 2017

https://github.com/dlmanning/gulp-sass/releases/tag/v3.0.0

v2.3.2

June 15, 2016

https://github.com/dlmanning/gulp-sass/releases/tag/v2.3.2

v2.3.1

April 22, 2016

https://github.com/dlmanning/gulp-sass/releases/tag/v2.3.1

v2.3.0

April 21, 2016

https://github.com/dlmanning/gulp-sass/releases/tag/v2.3.0

v2.3.0-beta.1

February 4, 2016

https://github.com/dlmanning/gulp-sass/releases/tag/v2.3.0-beta.1

v2.2.0

February 4, 2016

https://github.com/dlmanning/gulp-sass/releases/tag/v2.2.0

v2.1.0

November 2, 2015

https://github.com/dlmanning/gulp-sass/releases/tag/v2.1.0

v2.1.0-beta

September 21, 2015

  • Change :arrow_up: Bump to Node Sass 3.4.0-beta1

v2.0.4

July 15, 2015

  • Fix Relative file path now uses file.relative instead of arcane split('/').pop magic. Resolves lots of issues with source map paths.

  • Fix Empty partials no longer copied to CSS folder

v2.0.3

June 27, 2015

  • Fix Empty partials no longer copied to CSS folder

v2.0.2

June 25, 2015

  • Fix Error in watch stream preventing watch from continuing

v2.0.1

May 13, 2015

  • Fix Source maps now work as expected with Autoprefixer
  • Fix Current file directory unshift onto includePaths stack so it's checked first
  • Fix Error message returned is unformatted so as to not break other error handling (i.e. gulp-notify)

v2.0.0

May 6, 2015

  • Change :arrow_up: Bump to Node Sass 3.0.0

v2.0.0-alpha.1

March 26, 2015

  • New Added renderSync option that can be used through sass.sync()

March 24, 2015

  • Change Updated to node-sass 3.0.0-alpha.1
  • New Added support for gulp-sourcemaps including tests
  • New Added .editorconfig for development consistency
  • New Added linting and test for said linting
  • Change Updated the README
  • New logError function to make streaming errors possible instead of breaking the stream

1.3.3

  • updated to node-sass 2.0 (final)
  • should now work with node 0.12 and io.js

1.3.2

  • fixed errLogToConsole

1.3.1

  • bug fix

Version 1.3.0

  • Supports node-sass 2.0 (thanks laurelnaiad!)