-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make this package implementation-agnostic #694
Conversation
Rather than always loading Node Sass, this now requires users to pass in either Dart Sass or Node Sass to the require() call. Closes dlmanning#672
The linter wants me to add a trailing comma to my argument list, but it doesn't look like that works on Node 6.x. What should I do? |
@dlmanning Ping! |
@xzyfer As we discussed offline, I updated this to continue loading Node Sass by default, but to document support for Dart Sass and encourage users to explicitly choose their implementation. Please take a look. |
This documents the option to use Dart Sass, and encourages users to explicitly choose their implementation, but it doesn't change the existing behavior.
Any chance we can get this merged? :) |
Normally I'm not a fan of commenting in order to notify the project leads, but there hasn't been really much activity here. Please can someone have a look and give an update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing blocking, just some feedback
README.md
Outdated
@@ -26,6 +26,8 @@ Something like this will compile your Sass files: | |||
var gulp = require('gulp'); | |||
var sass = require('gulp-sass'); | |||
|
|||
sass.compiler = require(node-sass'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If node-sass
is the default, this doesn't seem needed
@@ -13,7 +13,7 @@ Only [Active LTS and Current releases][1] are supported. | |||
# Install | |||
|
|||
``` | |||
npm install gulp-sass --save-dev | |||
npm install node-sass gulp-sass --save-dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is still the included default this doesn't need to change
|
||
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: | ||
|
||
```javascript |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe mention the npm install dart-sass
here?
@@ -56,9 +60,36 @@ gulp.task('sass:watch', function () { | |||
}); | |||
``` | |||
|
|||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The explicit compiler would be a breaking change and probably dealt with then instead of recommending it now. I'm just thinking if the future change happens it might be through a different method and this locks in the API when it's not needed yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One way or another, there needs to be a way of overriding the compiler. That's the whole point of this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically overriding the compiler is already possible. Who knows what folks are doing with it. I'm OK with this because now we're at least documenting it as part of the API so we're committed to version correctly if we change.
## 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. | ||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should some validation around the file
option be added, or is the dart-sass error user friendly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing about this behavior is changing. I just slightly reformatted the paragraph to refer to Node Sass more consistently.
PS: I'm good if the future version tries to load |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My goal is to have the README encourage users to explicitly select the version of Sass they're using, so that in the future if the default changes or if an explicit decision is required--which is the way most plugins seem to be going--as many users' configurations as possible are already in a state that explicitly declares the Sass implementation they're using.
@@ -56,9 +60,36 @@ gulp.task('sass:watch', function () { | |||
}); | |||
``` | |||
|
|||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One way or another, there needs to be a way of overriding the compiler. That's the whole point of this change.
## 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. | ||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing about this behavior is changing. I just slightly reformatted the paragraph to refer to Node Sass more consistently.
Ping! |
Sorry for the delay. I took a break from GitHub. |
Released as v4.0.2 |
Thanks for this! But, would it not make sense to completely remove the dependency of
to get started? |
I would like this tremendously. I'm sure there are reasons for this but one of the big advantages for using dart-sass is not having to build node-sass and the complications that can come from that. As it is I'm still having to build node sass on install event if I choose not to use it. |
You're welcome to fork this project or use gulp-dart-sass, but there are no plans change node-sass as the default. |
* Update node-sass to 6.0.0 Also moves node-sass to devDependencies and peerDependencies. This helps prevent dupes and conflicts in packages using gulp-sass * Make mocha test compatible with gulp@4 * Update package version, engines * Remove node-sass as peer dependency * Replace through2 with transfob * Uninstall through2 * Throw error if compiler not set * Fix casing of Sass Co-authored-by: Michael Mifsud <xzyfer@gmail.com> * Use function arg to set compiler, use transfob package * Update test to new API signature * Update package versions * Fix eslint errors * Incorporate previously proposed documentation changes Copied from #694 * Update document outline, apply copyedits * Copyedit: overall clarifications * Call out migration guide, update badges * Document Gulp 4 usage * smol clarification * Copyedit some headings * Yet Another Copyedit™ * Update README.md Co-authored-by: Michael Mifsud <xzyfer@gmail.com>
Rather than always loading Node Sass, this now requires users to pass
in either Dart Sass or Node Sass to the require() call.
Closes #672