Skip to content
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

Help migrate Node Sass tools to be implementation-agnostic #267

Closed
7 tasks done
nex3 opened this issue Mar 23, 2018 · 10 comments
Closed
7 tasks done

Help migrate Node Sass tools to be implementation-agnostic #267

nex3 opened this issue Mar 23, 2018 · 10 comments
Labels
infrastructure JavaScript Issues particular to the Node.js distribution

Comments

@nex3
Copy link
Contributor

nex3 commented Mar 23, 2018

There are a number of Node.js tools out there today that use Node Sass, either directly or as a plugin for a broader build system. In order to make it easier for JS users to use Node Sass, we should help those tools migrate to something that supports Dart Sass as well.

Given a tool that depends on Node Sass and imports it directly, this probably means:

  • Removing the Node Sass dependency.

  • Changing the API to take the Sass implementation as a parameter. How this work may depend on the specific library involved, but one simple example would be:

    var sass = require('gulp-sass')(require('sass'));
  • This will probably be a breaking change to the package, so include a major version bump.

These seem to be the most widely-used integration packages:

(If anyone has any more packages, let us know!)

@nex3 nex3 added this to the Usability Equivalence milestone Mar 23, 2018
@nex3 nex3 added the JavaScript Issues particular to the Node.js distribution label Mar 23, 2018
@TheBosZ
Copy link

TheBosZ commented Jul 2, 2018

Rollup has a plugin: https://github.com/differui/rollup-plugin-sass

It supports sending a runtime: elycruz/rollup-plugin-sass#54

I submitted that PR specifically so I could use dart-sass rather than node-sass (node-sass takes about a billion years to compile and isn't any faster on my system).

@nex3
Copy link
Contributor Author

nex3 commented Jul 3, 2018

@TheBosZ Thanks for the link! Note though that as long as rollup-plugin-sass depends on node-sass, you'll still have to deal with the compile times on install.

@TheBosZ
Copy link

TheBosZ commented Jul 3, 2018

You're welcome!

I know about the dependency problem. I'm going to try to slowly convince people to move over to dart-sass.

I wish there was a way to define a peer dependency with an "OR".

@xzyfer
Copy link

xzyfer commented Jul 3, 2018

A note on compiles, you should never have to compile node-sass locally. We literally spend days doing the compilations for every release so you don't have to. Check the release notes for the installed node-sass for the tabled of supported Node versions and operating environments, and update to an appropriate version.

@TheBosZ
Copy link

TheBosZ commented Jul 3, 2018

@xzyfer It's great that you try to provide multiple versions, but I've often had node-gyp spin up a build step that's annoying.

It also often happens that I'll update node and it'll throw a warning about needing to be recompiled rather than just doing it itself.

Having a "pure javascript" way of doing sass is very desirable from a usability standpoint while node-sass is great for power users.

This also gets around crap like: sass/node-sass#1944

@robsonsobral
Copy link

@TheBosZ , when that happens, remove the ./node_modules and the lock files and install again.

@TheBosZ
Copy link

TheBosZ commented Jul 3, 2018

@robsonsobral That's not any easier than doing the npm rebuild node-sass --force dance. Especially when node_modules takes around 2 minutes to fully delete on Windows 7.

@xzyfer
Copy link

xzyfer commented Jul 3, 2018 via email

@TheBosZ
Copy link

TheBosZ commented Jul 5, 2018

As an update, rollup-plugin-sass has switched! https://github.com/differui/rollup-plugin-sass/blob/master/CHANGELOG.md

@nex3
Copy link
Contributor Author

nex3 commented Aug 9, 2019

Support for Dart Sass has landed in create-react-app: facebook/create-react-app#7496. I'm closing this out, since all the major players now support Dart Sass.

@nex3 nex3 closed this as completed Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure JavaScript Issues particular to the Node.js distribution
Projects
None yet
Development

No branches or pull requests

4 participants