-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add support for other SASS implementations #63
Add support for other SASS implementations #63
Conversation
Align to the `sass-loader` API in order to ease migrations.
When to publich |
outputStyle: 'nested', | ||
resolveURLs: true | ||
resolveURLs: true, | ||
sassOptions: {} |
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.
to avoid break change, you should add compatible code for outputStyle
, make sure the old way can still work
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.
I've explained why I needed to make that change in the "Caveat" section of the PR's description. Would it be an issue for you to publish a major version of this package after this PR is merged?
outputStyle: 'compressed' | ||
sassOptions: { | ||
outputStyle: 'compressed' | ||
} |
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.
do not change test case of old options API, you should add a new case for sassOptions
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.
cf. comment above.
Any updates on when this PR will be accepted/released? Looking forward to switching from sass-loader to fast-sass-loader but need the Dart support |
fwiw I ended up publishing a new package here: https://www.npmjs.com/package/awesome-sass-loader. |
} | ||
const options = utils.mergeDeep(defaults, loaderUtils.getOptions(ctx) || {}) | ||
const includePaths = options.includePaths | ||
const basedir = ctx.rootContext || options.context || ctx.options.context || process.cwd() | ||
const transformers = createTransformersMap(options.transformers) | ||
const implementation = options.implementation || require('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.
FYI – this doesn't work. I believe it fails to deep copy the reference to sass
or node-sass
from options.implementation
@yibn2008 if you're not going to maintain this package can you please allow others to take over? This needs to be merged in. |
@alexhobbs sorry for taking long time to reply, I've been very busy with my work recently, this PR has been merged in. |
@ngryman thanks for your great work 👍 |
|
@yibn2008 amazing, thank you very much! |
Following up on the recent discussions in #34, this PR brings support for any SASS-compatible library.
As a direct consequence
dart-sass
can be used as a drop-in replacement fornode-sass
.New
implementation
optionBy default
fast-sass-loader
will try to requirenode-sass
like before. If you want to override that behavior, you can use the newimplementation
to pass a different SASS implementation:Note that I've followed the exact same API that
sass-loader
exposes to ease migration fromsass-loader
tofast-sass-loader
.New
sassOptions
optionIf you need to pass additional options to the underlying implementation, it can now be done via the
sassOptions
option:Same as the previous I've followed the same API as
sass-loader
.Caveat
There is one minor caveat that comes with this new feature, we would need to deprecate the
outputStyle
option in favor ofsassOptions.outputStyle
. The main reason is thatdart-sass
andnode-sass
are not exactly compatible here, and accept a different set of values.nested
, which was the default value, is not support bydart-sass
.I think this change is beneficial maintainance-wise. Nesting SASS options in
sassOptions
and passing it directly to therender
function gives access to all available SASS options out of the box, without having to cherry pick and map these options in the loader options.@yibn2008 Let me know if this change is fine with you. If so I suppose you could publish a major version of this loader once this PR gets merged, and mention that people should switch from
outputStyle
tosassOptions.outputStyle
.