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

fix #5826; swap node-sass for dart-sass #5841

Closed
wants to merge 1 commit into from

Conversation

tomByrer
Copy link

@tomByrer tomByrer commented Mar 6, 2019

Description

Per #5826, node-sass is difficult to install sometimes. Dart-sass is the new 'standard'.

Specific Changes proposed

To get dart-sass to work, I had to fix the path to node_modules for @import (which is backward compatible with node-sass) & remove the --watch folder.

Testing

Works in Win10 & OSX Sierra, both using VSCode-git-bash & npm. Direct npm run build:css & npm start works, as does tests in Firefox & Safari. Compiling seems to be ~5-10% slower than node-sass, but we're only talking milliseconds.

I haven't tested editing an scss file & see if the --watch works (I assume runs only for the main entry & @imported files).

Thoughts

I have some reservations. Dart-sass is clearly a 1-woman show. Perhaps the spec changes (as few a there are now) is handled by a team, she writes 99% of the code. Amazing work, but I question long-term maintenance. Documentation has not been updated, with references to ruby-sass which is about to mothballed in weeks.

While LibSass may never be 100% reference, it became the de-facto standard. Node-sass has some minor behavior differences.

So, up to you guys if you want to make the switch; there are pros & cons.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chome, Firefox, IE)
    • Unit Tests updated or fixed
    • Docs/guides updated
    • Example created (starter template on JSBin)
  • Reviewed by Two Core Contributors

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work. 5-10% slowness is probably fine to mean that we aren't depending on a native module anymore.
I'll take some time next week to take this for a spin.

@@ -108,6 +108,7 @@
"conventional-changelog-cli": "^2.0.11",
"conventional-changelog-videojs": "^3.0.0",
"cross-env": "^5.2.0",
"dart-sass": "^1.17.2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the difference between dart-sass and sass? Seems like documentation mostly talks about sass.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be the exact same code, but double-listed in npm under different project names. Note the version, 'last publish', GitHub stats, etc:
https://www.npmjs.com/package/sass
https://www.npmjs.com/package/dart-sass

I chose dart-sass to be more clear about the origin. Both seemed to work the same when I was doing some wiring.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the docs for dart-sass specify the sass package, I think we should go with that.

@tomByrer
Copy link
Author

Any luck in your findings @gkatsev ?

@gkatsev
Copy link
Member

gkatsev commented Mar 28, 2019

I haven't had much time to look at it further.

Also, given that all the documentation says to use the sass module, I'd probably prefer that, even if they are otherwise equivalent.

@brandonocasey
Copy link
Contributor

I did some testing with this today:

Over 20 runs of npm run build:css with dart-sass it took: 3.44865s
Over 20 runs of npm run build:css with node-sass it took: 2.8767s
So a difference of ~16.5% or 0.57195s between the two

From a quick visual test on safari/chrome/firefox everything looks the same, but we probably want to test a lot of specifics since the diff has a lot of non-whitespace changes.

Here is a diff between the two that I did (where node-sass generated css, is being changed to dart-sass css)
eb852c4?w=1

@gkatsev
Copy link
Member

gkatsev commented Mar 28, 2019

Thanks @brandonocasey! Looking a bit more carefully, some of the non-whitespace changes are just a change in the ordering of the selectors, for example:

.vjs-icon-play, .video-js .vjs-big-play-button .vjs-icon-placeholder:before, .video-js .vjs-play-control .vjs-icon-placeholder {}

was changed to:

.vjs-icon-play, .video-js .vjs-play-control .vjs-icon-placeholder, .video-js .vjs-big-play-button .vjs-icon-placeholder:before {}

The difference is that before, vjs-big-play-button was first with vjs-play-control second but then they swapped.

@brandonocasey would you be able to run something like this replace on the output: s/\n}/}/? Basically, delete the new line before closing braces, that should minimize the changeset.

@brandonocasey
Copy link
Contributor

yeah let me see what I can do, I will re-post the diff after fixing some whitespace issues.

@brandonocasey
Copy link
Contributor

A bit better: #5903

@gkatsev
Copy link
Member

gkatsev commented Mar 28, 2019

Yeah, looks like it's mostly switching around the selectors or putting them on one line. We'll want to double check that it's true for all the changes, though. But seems like this can be made in a minor update for sure.

@brandonocasey
Copy link
Contributor

OK, I checked all the changes, and found three differences that I made comments on in that pull request. Seems like rounding is a bit different.

@gkatsev
Copy link
Member

gkatsev commented Mar 29, 2019

Hiding whitespace changes makes that other PR a lot more manageable.
I don't think that the precision change matters enough to warrant further investigation. Going from 15 3's to 10 3's is pretty much still just a bunch of 3s.

@gkatsev
Copy link
Member

gkatsev commented Apr 1, 2019

Also, we probably would want to turn off sourcemaps.

@gkatsev gkatsev added minor This PR can be added to a minor release. It should not be added to a patch release. chore labels Apr 1, 2019
@gkatsev
Copy link
Member

gkatsev commented Apr 4, 2019

So, what's I think there are a couple of things left here:

  • switch to the sass package
  • disable sourcemaps
  • rebase against master and fix package-lock conflicts

@gkatsev
Copy link
Member

gkatsev commented May 17, 2019

@tomByrer would you be able to finish the tasks outlines in my last comment?

@gkatsev
Copy link
Member

gkatsev commented Jun 17, 2019

I've created a new PR ( #6055 ) which dones the above tasks.

gkatsev added a commit that referenced this pull request Jun 17, 2019
This is a rebased and updated PR of #5841.

We wanted to use the sass package as that's what the docs recommend. We also wanted to disable source maps that CDN-linked code won't try to download it.

Fixes #5841, fixes #5826.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore minor This PR can be added to a minor release. It should not be added to a patch release. needs: updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants