diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b4649a1c..f6fd5abc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,10 +1,15 @@ # Contributing to Gulp Sass -Gulp Sass is a very light-weight [Gulp](https://github.com/gulpjs/gulp) wrapper for [`node-sass`](https://github.com/sass/node-sass), which in turn is a Node binding for [`libsass`](https://github.com/sass/libsass), which in turn is a port of [`Sass`](https://github.com/sass/sass). +`gulp-sass` is a very light-weight wrapper around either [Dart Sass][] or [Node Sass][] (which in turn is a Node binding for [LibSass][]. All of these are implementations of the [Sass][] language. + +[Dart Sass]: http://sass-lang.com/dart-sass +[Node Sass]: https://github.com/sass/node-sass +[LibSass]: https://sass-lang.com/libsass +[Sass]: https://sass-lang.com ## Submitting Issues -* Before creating a new issue, perform a [cursory search](https://github.com/issues?utf8=%E2%9C%93&q=repo%3Adlmanning%2Fgulp-sass+repo%3Asass%2Fnode-sass+repo%3Asass%2Flibsass+repo%3Asass%2Fsass+repo%3Asass-eyeglass%2Feyeglass) in the Gulp Sass, Node Sass, Libsass, and main Sass repos to see if a similar issue has already been submitted. Please also refer to our [Common Issues and Their Fixes](https://github.com/dlmanning/gulp-sass/wiki/Common-Issues-and-Their-Fixes) page for some basic troubleshooting. +* Before creating a new issue, perform a [cursory search](https://github.com/issues?utf8=%E2%9C%93&q=repo%3Adlmanning%2Fgulp-sass+repo%3Asass%2Fdart-sass+repo%3Asass%2Fnode-sass+repo%3Asass%2Flibsass+repo%3Asass%2Fsass+repo%3Asass-eyeglass%2Feyeglass) in the Gulp Sass, Dart Sass, Node Sass, Libsass, and main Sass repos to see if a similar issue has already been submitted. Please also refer to our [Common Issues and Their Fixes](https://github.com/dlmanning/gulp-sass/wiki/Common-Issues-and-Their-Fixes) page for some basic troubleshooting. * You can create an issue [here](https://github.com/dlmanning/gulp-sass/issues). Please include as many details as possible in your report. * Issue titles should be descriptive, explaining at the high level what it is about. * Please include the version of `gulp-sass`, Node, and NPM you are using, as well as what operating system you are having a problem on. @@ -60,4 +65,4 @@ When creating creating commits or updating the CHANGELOG, please **start** the c * :arrow_up: `:arrow_up:` when upgrading dependencies * :arrow_down: `:arrow_down:` when downgrading dependencies * :shirt: `:shirt:` when removing linter warnings -* :shipit: `:shipit:` when creating a new release +* :shipit: `:shipit:` when creating a new release \ No newline at end of file diff --git a/README.md b/README.md index c266742a..5e7ed849 100644 --- a/README.md +++ b/README.md @@ -1,154 +1,170 @@ -# gulp-sass [![Build Status](https://travis-ci.org/dlmanning/gulp-sass.svg?branch=master)](https://travis-ci.org/dlmanning/gulp-sass) [![Join the chat at https://gitter.im/dlmanning/gulp-sass](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dlmanning/gulp-sass?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![npm version](https://badge.fury.io/js/gulp-sass.svg)](http://badge.fury.io/js/gulp-sass) +# gulp-sass ![Build status](https://img.shields.io/travis/dlmanning/gulp-sass) [![Join the chat at https://gitter.im/dlmanning/gulp-sass](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dlmanning/gulp-sass?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ![Node support](https://img.shields.io/node/v/gulp-sass) ![NPM package version](https://img.shields.io/npm/v/gulp-sass?label=npm%20version) Sass plugin for [Gulp](https://github.com/gulpjs/gulp). -**_Before filing an issue, please make sure you have [Updated to the latest Gulp Sass](https://github.com/dlmanning/gulp-sass/wiki/Update-to-the-latest-Gulp-Sass) and have gone through our [Common Issues and Their Fixes](https://github.com/dlmanning/gulp-sass/wiki/Common-Issues-and-Their-Fixes) section._** +**_Before filing an issue, please make sure you have [updated to the latest version of `gulp-sass`](https://github.com/dlmanning/gulp-sass/wiki/Update-to-the-latest-Gulp-Sass) and have gone through our [Common Issues and Their Fixes](https://github.com/dlmanning/gulp-sass/wiki/Common-Issues-and-Their-Fixes) section._** -# Support +**Migrating your existing project to version 5? Please read our (short!) [migration guide](#migrating-to-version-5).** + +## Support Only [Active LTS and Current releases][1] are supported. [1]: https://github.com/nodejs/Release#release-schedule -# Install +## Installation + +To use `gulp-sass`, you must install both `gulp-sass` itself *and* a Sass compiler. `gulp-sass` supports both [Dart Sass][] and [Node Sass][], but Node Sass is [deprecated](https://sass-lang.com/blog/libsass-is-deprecated). We recommend that you use Dart Sass for new projects, and migrate Node Sass projects to Dart Sass when possible. + +Whichever compiler you choose, it's best to install these as dev dependencies: ``` -npm install node-sass gulp-sass --save-dev +npm install sass gulp-sass --save-dev ``` -# Basic Usage +## Usage + +**Note:** These examples assume you're using Gulp 4. For examples that work with Gulp 3, [check the docs for an earlier version of `gulp-sass`](https://github.com/dlmanning/gulp-sass/tree/v4.1.1). + +`gulp-sass` runs inside of Gulp tasks. No matter what else you do with `gulp-sass`, you must first import it into your gulpfile, making sure to pass it the compiler of your choice. From there, create a Gulp task that calls either `sass()` (to asynchronously render your CSS), or `sass.sync()` (to render it synchronously). Then, export your task with the `export` keyword. We'll show some examples of how to do that. + +**⚠️ Note:** With Dart Sass, **synchronous rendering is twice as fast as asynchronous rendering**. The Sass team is exploring ways to improve asynchronous rendering with Dart Sass, but for now you will get the best performance from `sass.sync()` + +### Render your CSS -Something like this will compile your Sass files: +To render your CSS with a build task, then watch your files for changes, you might write something like this.: ```javascript 'use strict'; var gulp = require('gulp'); -var sass = require('gulp-sass'); +var sass = require('gulp-sass')(require('sass')); -sass.compiler = require('node-sass'); - -gulp.task('sass', function () { +function buildStyles() { return gulp.src('./sass/**/*.scss') .pipe(sass().on('error', sass.logError)) .pipe(gulp.dest('./css')); -}); +}; -gulp.task('sass:watch', function () { +exports.buildStyles = buildStyles; +exports.watch = function () { gulp.watch('./sass/**/*.scss', ['sass']); -}); +}; ``` -You can also compile synchronously, doing something like this: - -```javascript -'use strict'; - -var gulp = require('gulp'); -var sass = require('gulp-sass'); - -sass.compiler = require('node-sass'); +With synchronous rendering, that Gulp task looks like this: -gulp.task('sass', function () { +``` javascript +function buildStyles() { 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']); -}); +}; ``` -You can choose whether to use [Dart Sass][] or [Node Sass][] by setting the `sass.compiler` property. Node Sass will be used by default, but it's strongly recommended that you set it explicitly for forwards-compatibility in case the default ever changes. +### Render with options -[Dart Sass]: http://sass-lang.com/dart-sass -[Node Sass]: https://github.com/sass/node-sass +To change the final output of your CSS, you can pass an options object to your renderer. `gulp-sass` supports [Node Sass's render options](https://github.com/sass/node-sass#options), with two unsupported exceptions: -Note that when using Dart Sass, **synchronous compilation is twice as fast as asynchronous compilation** by default, due to the overhead of asynchronous callbacks. To avoid this overhead, you can use the [`fibers`](https://www.npmjs.com/package/fibers) package to call asynchronous importers from the synchronous code path. To enable this, pass the `Fiber` class to the `fiber` option: +- The `data` option, which is used by `gulp-sass` internally. +- The `file` option, which has undefined behavior that may change without notice. + +For example, to compress your CSS, you can call `sass({outputStyle: 'compressed'}`. In the context of a Gulp task, that looks like this: ```javascript -'use strict'; +function buildStyles() { + return gulp.src('./sass/**/*.scss') + .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) + .pipe(gulp.dest('./css')); +}; -var Fiber = require('fibers'); -var gulp = require('gulp'); -var sass = require('gulp-sass'); +exports.buildStyles = buildStyles; +``` -sass.compiler = require('sass'); +Or this for synchronous rendering: -gulp.task('sass', function () { +```javascript +function buildStyles() { return gulp.src('./sass/**/*.scss') - .pipe(sass({fiber: Fiber}).on('error', sass.logError)) + .pipe(sass.sync({outputStyle: 'compressed'}).on('error', sass.logError)) .pipe(gulp.dest('./css')); -}); +}; -gulp.task('sass:watch', function () { - gulp.watch('./sass/**/*.scss', ['sass']); -}); +exports.buildStyles = buildStyles; ``` -## Options - -Pass in options just like you would for [Node Sass](https://github.com/sass/node-sass#options); they will be passed along just as if you were using Node Sass. Except for the `data` option which is used by gulp-sass internally. Using the `file` option is also unsupported and results in undefined behaviour that may change without notice. +### Include a source map -For example: +`gulp-sass` can be used in tandem with [`gulp-sourcemaps`](https://github.com/floridoo/gulp-sourcemaps) to generate source maps for the Sass-to-CSS compilation. You will need to initialize `gulp-sourcemaps` _before_ running `gulp-sass`, and write the source maps after. ```javascript -gulp.task('sass', function () { - return gulp.src('./sass/**/*.scss') - .pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) - .pipe(gulp.dest('./css')); -}); +var sourcemaps = require('gulp-sourcemaps'); + +function buildStyles() { + return gulp.src('./sass/**/*.scss') + .pipe(sourcemaps.init()) + .pipe(sass().on('error', sass.logError)) + .pipe(sourcemaps.write()) + .pipe(gulp.dest('./css')); +} + +exports.buildStyles = buildStyles; ``` -Or this for synchronous code: +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. ```javascript -gulp.task('sass', function () { - return gulp.src('./sass/**/*.scss') - .pipe(sass.sync({outputStyle: 'compressed'}).on('error', sass.logError)) - .pipe(gulp.dest('./css')); -}); +var sourcemaps = require('gulp-sourcemaps'); + +function buildStyles() { + return gulp.src('./sass/**/*.scss') + .pipe(sourcemaps.init()) + .pipe(sass().on('error', sass.logError)) + .pipe(sourcemaps.write('./maps')) + .pipe(gulp.dest('./css')); +}; + +exports.buildStyles = buildStyles; ``` -## Source Maps +

Migrating to version 5

-`gulp-sass` can be used in tandem with [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) to generate source maps for the Sass to CSS compilation. You will need to initialize [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) prior to running `gulp-sass` and write the source maps after. +`gulp-sass` version 5 requires Node 12 or later, and introduces some breaking changes. Additionally, changes in Node itself mean that we should no longer use Node fibers to speed up asynchronous rendering with Dart Sass. -```javascript -var sourcemaps = require('gulp-sourcemaps'); +### Setting a Sass compiler -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')); -}); +As of version 5, `gulp-sass` _does not include a default Sass compiler_, so you must install one (either `node-sass` or `sass`) along with `gulp-sass`. + +``` +npm install sass gulp-sass --save-dev ``` -By default, [gulp-sourcemaps](https://github.com/floridoo/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. +Then, you must explicitly set that compiler in your gulpfille. Instead of setting a `compiler` prop on the `gulp-sass` instance, you pass the compiler into a function call when instantiating `gulp-sass`. -```javascript -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')); -}); +These changes look something like this: + +``` diff +- var sass = require('gulp-sass')); +- var compiler = require('sass'); +- sass.compiler = compiler; ++ var sass = require('gulp-sass')(require('sass')); ``` -# Issues +### What about fibers? -`gulp-sass` is a very light-weight wrapper around either [Dart Sass][] or [Node Sass][] (which in turn is a Node binding for [LibSass][]). Because of this, the issue you're having likely isn't a `gulp-sass` issue, but an issue with one those projects or with [Sass][] as a whole. +We used to recommend Node fibers as a way to speed up asynchronous rendering with Dart Sass. Unfortunately, [Node fibers are discontinued](https://sass-lang.com/blog/node-fibers-discontinued). The Sass team is exploring its optons for future performance improvements, but for now you will get the best performance from `sass.sync()`. -[LibSass]: https://sass-lang.com/libsass -[Sass]: https://sass-lang.com +## Issues + +`gulp-sass` is a light-weight wrapper around either [Dart Sass][] or [Node Sass][] (which in turn is a Node binding for [LibSass][]. Because of this, the issue you're having likely isn't a `gulp-sass` issue, but an issue with one those projects or with [Sass][] as a whole. 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 LibSass 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 Node Sass 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. + +[Dart Sass]: http://sass-lang.com/dart-sass +[LibSass]: https://sass-lang.com/libsass +[Node Sass]: https://github.com/sass/node-sass +[Sass]: https://sass-lang.com diff --git a/index.js b/index.js index b0aed3b9..7b011ef4 100644 --- a/index.js +++ b/index.js @@ -2,17 +2,17 @@ const chalk = require('chalk'); const PluginError = require('plugin-error'); const replaceExtension = require('replace-ext'); const stripAnsi = require('strip-ansi'); -const through = require('through2'); +const transfob = require('transfob'); const clonedeep = require('lodash/cloneDeep'); const path = require('path'); const applySourceMap = require('vinyl-sourcemaps-apply'); const PLUGIN_NAME = 'gulp-sass'; -////////////////////////////// +/// /////////////////////////// // Main Gulp Sass function -////////////////////////////// -const gulpSass = (options, sync) => through.obj((file, enc, cb) => { // eslint-disable-line consistent-return +/// /////////////////////////// +const gulpSass = (options, sync) => transfob((file, enc, cb) => { // eslint-disable-line consistent-return if (file.isNull()) { return cb(null, file); } @@ -59,9 +59,9 @@ const gulpSass = (options, sync) => through.obj((file, enc, cb) => { // eslint-d opts.sourceMapContents = true; } - ////////////////////////////// + /// /////////////////////////// // Handles returning the file to the stream - ////////////////////////////// + /// /////////////////////////// const filePush = (sassObj) => { let sassMap; let sassMapFile; @@ -88,7 +88,7 @@ const gulpSass = (options, sync) => through.obj((file, enc, cb) => { // eslint-d } // Remove 'stdin' from souces and replace with filenames! - sassMap.sources = sassMap.sources.filter(src => src !== 'stdin' && src); + sassMap.sources = sassMap.sources.filter((src) => src !== 'stdin' && src); // Replace the map file with the original file name (but new extension) sassMap.file = replaceExtension(sassFileSrc, '.css'); @@ -106,9 +106,9 @@ const gulpSass = (options, sync) => through.obj((file, enc, cb) => { // eslint-d cb(null, file); }; - ////////////////////////////// + /// /////////////////////////// // Handles error message - ////////////////////////////// + /// /////////////////////////// const errorM = (error) => { const filePath = (error.file === 'stdin' ? file.path : error.file) || file.path; const relativePath = path.relative(process.cwd(), filePath); @@ -123,9 +123,9 @@ const gulpSass = (options, sync) => through.obj((file, enc, cb) => { // eslint-d }; if (sync !== true) { - ////////////////////////////// + /// /////////////////////////// // Async Sass render - ////////////////////////////// + /// /////////////////////////// const callback = (error, obj) => { // eslint-disable-line consistent-return if (error) { return errorM(error); @@ -135,9 +135,9 @@ const gulpSass = (options, sync) => through.obj((file, enc, cb) => { // eslint-d gulpSass.compiler.render(opts, callback); } else { - ////////////////////////////// + /// /////////////////////////// // Sync Sass render - ////////////////////////////// + /// /////////////////////////// try { filePush(gulpSass.compiler.renderSync(opts)); } catch (error) { @@ -146,23 +146,35 @@ const gulpSass = (options, sync) => through.obj((file, enc, cb) => { // eslint-d } }); -////////////////////////////// +/// /////////////////////////// // Sync Sass render -////////////////////////////// -gulpSass.sync = options => gulpSass(options, true); +/// /////////////////////////// +gulpSass.sync = (options) => gulpSass(options, true); -////////////////////////////// +/// /////////////////////////// // Log errors nicely -////////////////////////////// +/// /////////////////////////// gulpSass.logError = function logError(error) { const message = new PluginError('sass', error.messageFormatted).toString(); process.stderr.write(`${message}\n`); this.emit('end'); }; -////////////////////////////// -// Store compiler in a prop -////////////////////////////// -gulpSass.compiler = require('node-sass'); - -module.exports = gulpSass; +module.exports = (compiler) => { + if (!compiler || !compiler.render) { + const message = new PluginError( + PLUGIN_NAME, + '\n' + + 'gulp-sass 5 does not have a default Sass compiler; please set one yourself.\n' + + 'Both the `sass` and `node-sass` packages are permitted.\n' + + + 'For example, in your gulpfile:\n\n' + + ' var sass = require(\'gulp-sass\')(require(\'sass\'));\n', + { showProperties: false }, + ).toString(); + process.stderr.write(`${message}\n`); + process.exit(1); + } + gulpSass.compiler = compiler; + return gulpSass; +}; diff --git a/package.json b/package.json index eece4c52..1cdd2b1c 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "gulp-sass", - "version": "4.1.1", + "version": "5.0.0", "description": "Gulp plugin for sass", "main": "index.js", "engines": { - "node": ">=6" + "node": ">=12" }, "scripts": { - "test": "./node_modules/.bin/mocha test" + "test": "mocha test" }, "repository": { "type": "git", @@ -24,28 +24,29 @@ "url": "https://github.com/dlmanning/gulp-sass/issues" }, "dependencies": { - "chalk": "^2.3.0", + "chalk": "^4.1.1", "lodash": "^4.17.20", - "node-sass": "^4.8.3", "plugin-error": "^1.0.1", - "replace-ext": "^1.0.0", - "strip-ansi": "^4.0.0", - "through2": "^2.0.0", - "vinyl-sourcemaps-apply": "^0.2.0" + "replace-ext": "^2.0.0", + "strip-ansi": "^6.0.0", + "transfob": "^1.0.0", + "vinyl-sourcemaps-apply": "^0.2.1" }, "devDependencies": { - "autoprefixer": "^8.1.0", - "eslint": "^4.18.2", - "eslint-config-airbnb-base": "^12.1.0", - "eslint-plugin-import": "^2.9.0", - "globule": "^1.0.0", - "gulp": "^3.8.11", - "gulp-postcss": "^7.0.1", - "gulp-sourcemaps": "^2.6.4", - "gulp-tap": "^0.1.3", - "mocha": "^5.0.4", - "rimraf": "^2.4.3", - "should": "^13.2.1", - "vinyl": "^2.1.0" + "autoprefixer": "^10.2.6", + "eslint": "^7.28.0", + "eslint-config-airbnb-base": "^14.2.1", + "eslint-plugin-import": "^2.23.4", + "globule": "^1.3.2", + "gulp": "^4.0.2", + "gulp-postcss": "^9.0.0", + "gulp-sourcemaps": "^3.0.0", + "gulp-tap": "^2.0.0", + "mocha": "^9.0.0", + "node-sass": "^6.0.0", + "postcss": "^8.3.4", + "rimraf": "^3.0.2", + "should": "^13.2.3", + "vinyl": "^2.2.1" } } diff --git a/test/main.js b/test/main.js index 2ae56f05..d7739a92 100644 --- a/test/main.js +++ b/test/main.js @@ -2,7 +2,6 @@ const should = require('should'); const Vinyl = require('vinyl'); const path = require('path'); const fs = require('fs'); -const sass = require('../index'); const rimraf = require('rimraf'); const gulp = require('gulp'); const sourcemaps = require('gulp-sourcemaps'); @@ -11,6 +10,8 @@ const autoprefixer = require('autoprefixer'); const tap = require('gulp-tap'); const globule = require('globule'); +const sass = require('../index')(require('node-sass')); + const createVinyl = (filename, contents) => { const base = path.join(__dirname, 'scss'); const filePath = path.join(base, filename); @@ -23,7 +24,7 @@ const createVinyl = (filename, contents) => { }); }; -const normaliseEOL = str => str.toString('utf8').replace(/\r\n/g, '\n'); +const normaliseEOL = (str) => str.toString('utf8').replace(/\r\n/g, '\n'); describe('test helpers', () => { it('should normalise EOL', (done) => { @@ -224,14 +225,14 @@ describe('gulp-sass -- async compile', () => { it('should work with gulp-sourcemaps', (done) => { const sassFile = createVinyl('inheritance.scss'); - sassFile.sourceMap = '{' + - '"version": 3,' + - '"file": "scss/subdir/multilevelimport.scss",' + - '"names": [],' + - '"mappings": "",' + - '"sources": [ "scss/subdir/multilevelimport.scss" ],' + - '"sourcesContent": [ "@import ../inheritance;" ]' + - '}'; + sassFile.sourceMap = '{' + + '"version": 3,' + + '"file": "scss/subdir/multilevelimport.scss",' + + '"names": [],' + + '"mappings": "",' + + '"sources": [ "scss/subdir/multilevelimport.scss" ],' + + '"sourcesContent": [ "@import ../inheritance;" ]' + + '}'; // Expected sources are relative to file.base const expectedSources = [ @@ -425,14 +426,14 @@ describe('gulp-sass -- sync compile', () => { 'includes/_dogs.sass', ]; - sassFile.sourceMap = '{' + - '"version": 3,' + - '"file": "scss/subdir/multilevelimport.scss",' + - '"names": [],' + - '"mappings": "",' + - '"sources": [ "scss/subdir/multilevelimport.scss" ],' + - '"sourcesContent": [ "@import ../inheritance;" ]' + - '}'; + sassFile.sourceMap = '{' + + '"version": 3,' + + '"file": "scss/subdir/multilevelimport.scss",' + + '"names": [],' + + '"mappings": "",' + + '"sources": [ "scss/subdir/multilevelimport.scss" ],' + + '"sourcesContent": [ "@import ../inheritance;" ]' + + '}'; const stream = sass.sync(); stream.on('data', (cssFile) => { @@ -469,8 +470,8 @@ describe('gulp-sass -- sync compile', () => { .pipe(tap((file) => { should.exist(file.sourceMap); file.sourceMap.sources.should.eql(expectedSourcesAfter); - })) - .on('end', done); + })); + done(); }); it('should work with gulp-sourcemaps and a globbed source', (done) => { @@ -491,8 +492,8 @@ describe('gulp-sass -- sync compile', () => { const actual = normaliseEOL(file.sourceMap.sourcesContent[0]); const expected = normaliseEOL(filesContent[path.normalize(file.sourceMap.sources[0])]); actual.should.eql(expected); - })) - .on('end', done); + })); + done(); }); it('should work with gulp-sourcemaps and autoprefixer with different file.base', (done) => { @@ -519,8 +520,8 @@ describe('gulp-sass -- sync compile', () => { .pipe(tap((file) => { should.exist(file.sourceMap); file.sourceMap.sources.should.eql(expectedSourcesAfter); - })) - .on('end', done); + })); + done(); }); it('should work with empty files', (done) => { @@ -533,7 +534,7 @@ describe('gulp-sass -- sync compile', () => { } catch (e) { should.fail(false, true, 'Empty file was produced'); } - })) - .on('end', done); + })); + done(); }); });