Gulp-sass: Add support for Dart Sass

Created on 23 Mar 2018  Â·  9Comments  Â·  Source: dlmanning/gulp-sass

Dart Sass is in Release Candidate phase now, with a full release probably coming next week. It would be great to add support to this package for choosing between Node Sass and Dart Sass. I'm willing to create a pull request, but I'm not sure what the best design would be.

Right now, this package has a compiler field that can be configured, like so:

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

However, because gulp-sass includes Node Sass in its dependencies, this still requires users to get Node Sass even if they want to use Dart Sass—which is often a big pain, since that can involve building C code. One way around this would be to remove Node Sass as a dependency and require users to pass in the version of the compiler they want to use, either using the existing API or using something like

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

Most helpful comment

I'd really like Dart Sass to be a first-class implementation, and naming its package gulp-dart-sass while the package named gulp-sass only supports Node Sass doesn't really frame it that way. I'd prefer to see a solution where users explicitly decide which implementation to use, possibly using the pattern I outlined above, even if that does increase the first-time setup friction somewhat.

We see relatively few issues with regards to installation of node-sass.

@xzyfer You and I may be hearing from different people, but I've heard a lot of noise around people who have had bad Node Sass installation experiences.

All 9 comments

hey, I am only missing Gulp-sass file here in this list. I am new to wordpress So i don't know how to add this particular file into my this list.Please guide me. windows 10. Thankx
capture

Want to bump and continue discussion. Dependency-wise, being able to avoid a download of node-sass would be a big plus unless the user opts-in.

Based on the conversation in https://github.com/sindresorhus/grunt-sass/issues/278, I'm not sure there's a solution without a drawback:

  • Setting up dart-sass and node-sass as peerDependencies will trigger warnings for whichever is missing
  • Setting optionalDependencies will trigger a download, and fail if the node-sass binary is missing; which isn't great either
  • We could declare neither but that's not really a great DX

Any other options?

We see relatively few issues with regards to installation of node-sass. Our
resolution to this issue will be to enable dart-sass as an option for those
who want it, without introducing any new friction to the millions of
monthly downloads that happen issue free.

Given the nature of gulp packages I see space for a gulp-dart-sass to live
along side gulp-ruby-sass etc..

On Tue., 8 May 2018, 6:31 pm Matt Steele, notifications@github.com wrote:

Want to bump and continue discussion. Dependency-wise, being able to avoid
a download of node-sass would be a big plus unless the user opts-in.

Based on the conversation in sindresorhus/grunt-sass#278
https://github.com/sindresorhus/grunt-sass/issues/278, I'm not sure
there's a tractable solution:

  • Setting up dart-sass and node-sass as peerDependencies will trigger
    warnings for whichever is missing
  • Setting optionalDependencies will trigger a download, and fail if
    the node-sass binary is missing; which isn't great either
  • We could declare neither but that's not really a great DX

Any other options?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/dlmanning/gulp-sass/issues/672#issuecomment-387462801,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjZWCJ9i1-DXpV7XdV3Ad1xbwo7Ohygks5twchegaJpZM4S5cEe
.

I've gone ahead and forked to gulp-dart-sass and published a proof of concept to npm: https://www.npmjs.com/package/gulp-dart-sass

A few features aren't working (namely around sourcemaps) but hopefully this is enough for folks to begin using.

I'd really like Dart Sass to be a first-class implementation, and naming its package gulp-dart-sass while the package named gulp-sass only supports Node Sass doesn't really frame it that way. I'd prefer to see a solution where users explicitly decide which implementation to use, possibly using the pattern I outlined above, even if that does increase the first-time setup friction somewhat.

We see relatively few issues with regards to installation of node-sass.

@xzyfer You and I may be hearing from different people, but I've heard a lot of noise around people who have had bad Node Sass installation experiences.

I've created https://github.com/dlmanning/gulp-sass/pull/694 as a potential implementation of this, using the require('gulp-sass')(require('sass')) method of customization.

@mattdsteele could you please update the links in the package.json and readme to point at the correct repository? We've started receiving issues we're not suited to resolve.

@xzyfer Removed references to gulp-sass in the readme.

package.json was already referencing my repo for repository and bugs, let me know if there's a different link you'd like updated.

Thanks :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrgnou picture mrgnou  Â·  6Comments

webchaz picture webchaz  Â·  3Comments

tbolon picture tbolon  Â·  6Comments

levani picture levani  Â·  7Comments

JamesVanWaza picture JamesVanWaza  Â·  4Comments