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

Switch from Libsass to supported Sass implementation #1535

Closed
doamatto opened this issue Jun 25, 2021 · 18 comments
Closed

Switch from Libsass to supported Sass implementation #1535

doamatto opened this issue Jun 25, 2021 · 18 comments
Labels
done in pr Already done in a PR enhancement

Comments

@doamatto
Copy link
Contributor

doamatto commented Jun 25, 2021

Libsass is deprecated, and only gets maintenance updates. The Sass team recommends people move to Dart Sass instead. It's still fast, compiles to one binary, and, as aforementioned, is being supported and updated. It would be a nice thing to consider

@Keats
Copy link
Collaborator

Keats commented Jun 25, 2021

I'm following https://github.com/kaj/rsass and https://github.com/connorskees/grass to replace libsass but grass doesn't seem very active so most likely I'll switch to rsass once it can compile bootstrap. If it can compile bootstrap it's probably good enough for 99% of the sites.

@awulkan
Copy link

awulkan commented Jul 9, 2021

Is there any reason for wanting to use a rust based compiler instead of one based on dart? It feels like the rust based compilers will always be playing catch up with dart-sass.
Anyway it appears that the grass compiler is being worked on again. If it's better than LibSass it might be a good idea to transition to that one while waiting for rsass. Unless you feel like it would introduce too many breaking changes.

@Keats
Copy link
Collaborator

Keats commented Jul 9, 2021

Is there any reason for wanting to use a rust based compiler instead of one based on dart?

There's no way to FFI with Dart from Rust I believe? You would have to ship the dart-sass binary along with it and then there's no point doing that, people can just do npm install themselves.
In practice I don't think many people are using the new features of Sass present in dart-sass or are even aware they exist. As long as it can compile some common frameworks like Bootstrap it should be fine.

@awulkan
Copy link

awulkan commented Jul 9, 2021

There's no way to FFI with Dart from Rust I believe?

I've seen a lot of articles published about FFI between Dart/Flutter and Rust lately, but I haven't looked into it. I'm not here to convince you to use dart-sass though. I was just a bit curious. :)

Side note:
While looking up Rust <-> Dart FFI I came across this site, built with Zola, which I thought was pretty cool.
https://thlorenz.com/rid-site/

@doamatto
Copy link
Contributor Author

doamatto commented Jul 9, 2021

While looking up Rust <-> Dart FFI I came across this site, built with Zola, which I thought was pretty cool.

As far as I can see, this is just for Rust to be used in Flutter, which wouldn't be the scope of Zola; correct me if I'm wrong, of course.

There's no way to FFI with Dart from Rust I believe?

I've seen a lot of articles published about FFI between Dart/Flutter and Rust lately,

Flutter is just a framework for a slew of platforms built on Dart; not all Dart or Flutter packages work on the opposite scope, actually. Afaik, Dart is in theory capable of being used in Rust (see dart:ffi) Also see: dart-sys and ffigen

people can just do npm install themselves.

Fun fact: the version of Dart Sass on NPM is different from Dart Sass; it's compiled to JavaScript, instead of being a native bin. This would make build times (at least from my experience) considerably slower.

I think using the native libraries are the best bet, with grass supporting Bootstrap (see connorskees/grass/issues/4.

@doamatto doamatto changed the title Switching from Libsass to Dart Sass Switch from Libsass to supported Sass implementation Jul 9, 2021
@Keats
Copy link
Collaborator

Keats commented Dec 7, 2021

Has anyone compared grass and rsass? grass can compile bootstrap which is a huge plus in terms of general support.
Libsass is deprecated so we should move to one of them soon-ish.

@tempbottle
Copy link

I vote for grass, as I use bulma-scss with it and it works fine. But it take almost 3 secs on my laptop for a whole process.

ixti added a commit to ixti/ixti-overlay that referenced this issue Jan 17, 2022
Gonna keep it here until zola resolves:
* getzola/zola#1535

See: https://bugs.gentoo.org/830657
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Alexey Zapparov <[email protected]>
gentoo-bot pushed a commit to gentoo/guru that referenced this issue Jan 17, 2022
Move ebuild to my personal overlay until zola switch from libsass to
more up-to-date implementation:
* getzola/zola#1535

The problem with sass-rs is that sass-sys build.rs is somewhat not fun
to monkey-patch in order to make QA pass. Sorry about that.

Closes: https://bugs.gentoo.org/830657
Signed-off-by: Alexey Zapparov <[email protected]>
@mikekasprzak
Copy link

There seems to be conflicting reports about the deprecation of libsass. Officially it's deprecated, but contrary to "only doing maintenance" releases, one of the maintainers has been actively back-porting Dart-Sass, and sharing progress reports in the release notes.

https://github.com/sass/libsass/releases/

Like everything there's no timeline for the 4.0 release, but it appears word of libsass's death may have been premature.

@Keats
Copy link
Collaborator

Keats commented Jan 26, 2022

Yeah I've seen those updates but libsass is also a huge pain to build, especially on Windows - not to mention a very long compile time. Moving to grass/rsass would solve those issues while probably getting more features.
I need to have a look at both to see how mature they are and whether they can already replace libsass or not

@rlee287
Copy link

rlee287 commented Jul 13, 2022

If anyone is interested, I made a fork at https://github.com/rlee287/zola/tree/rsass where I switched to rsass, and which I chose because it was easier to port the existing code to use it. I was successfully able to use the "zhuia" theme with this fork, along with customizing it a bit using sass.color features unsupported by sass-rs.

I can open a PR with this module change if you'd like that.

@Keats
Copy link
Collaborator

Keats commented Jul 13, 2022

Sweet, it seems pretty straightforward. I probably need to look at rsass and see if i can reduce the deps a bit, so probably for 0.17

@pinpox
Copy link

pinpox commented Jul 28, 2022

Will this allow to use the built-in sass modules like sass:color? I'm trying to do color manipulation as described here https://sass-lang.com/documentation/modules/color

@Keats
Copy link
Collaborator

Keats commented Jul 28, 2022

I don't know if there's a list of missing features compared to the original impl

@Keats
Copy link
Collaborator

Keats commented Jan 2, 2023

It looks like https://github.com/connorskees/grass now supports the indented syntax and has a good coverage of dart-sass features.

Keats added a commit that referenced this issue Jan 8, 2023
@Keats
Copy link
Collaborator

Keats commented Jan 8, 2023

I've pushed grass support replacing libsass to the next branch. Can people try it?

@Keats Keats added the done in pr Already done in a PR label Jan 9, 2023
@focusaurus
Copy link
Contributor

I tried it and it works fine for me. I was able to remove all my uses of unquote().

@tempbottle
Copy link

it works fine, great!

@kamoshi
Copy link

kamoshi commented Jan 13, 2023

I've just tried using it for a website I'm trying to port to Zola and it does seem to support Sass very well. It even supports the new @use rule syntax for importing modules which is supposed to supersede the @import syntax. The libsass implementation doesn't support it at all

@Keats Keats closed this as completed in fcbb21a Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done in pr Already done in a PR enhancement
Projects
None yet
Development

No branches or pull requests

10 participants