sbt-sassify icon indicating copy to clipboard operation
sbt-sassify copied to clipboard

libsass is now deprecated... move to dartsass

Open bpossolo opened this issue 4 years ago • 18 comments

As of Oct 26, 2020, libsass is now deprecated :(

The official recommendation is to move to dart sass instead.

I'm not sure what this means for the sbt-sassify plugin but it seems like having the Dart Sass binary installed locally may become a pre-requisite in the future.

bpossolo avatar Nov 01 '20 02:11 bpossolo

I’m pretty sure that the dart sass library can be compiled to a native library as well. I will have a look at it.

irundaia avatar Nov 29 '20 15:11 irundaia

Any progress on this? It would be great to be able to use @use, which only Dart Sass supports.

danellis avatar May 05 '21 10:05 danellis

I'll try to see what the impact would be of migrating from libsass to a version of dart-sass compiled to libsass. Unfortunately, that would require having node on the target system. I haven't yet found a way to compile dart code to a shared library.

irundaia avatar May 08 '21 21:05 irundaia

@bpossolo @danellis,

I've been making good progress with running a natively compiled version of dart-sass. Would you be able to help me test whether this solution works for you as well? (I'm trying to test it on as many platforms as I can.)

irundaia avatar May 15 '21 06:05 irundaia

@irundaia sure I can help you test it out on my M1 Mac! I ended up moving to the dart-sass js implementation in the meantime since I was blocked but I'm sure others will benefit from the sbt-sassify update.

bpossolo avatar May 16 '21 16:05 bpossolo

@irundaia Yeah, I can help test (Intel macOS). I'm currently using dart-sass from IntelliJ's file watchers, so I'd be glad to get away from that.

danellis avatar May 20 '21 09:05 danellis

+1, I can test on Ubuntu / Fedora environments. Would love to use sassify and dartsass.

rwsargent avatar Jan 16 '22 20:01 rwsargent

@irundaia Dart Sass releases its binaries on github https://github.com/sass/dart-sass/releases/tag/1.49.0. Changing the bundled binaries inside the published jar should solve the problem.

Lasering avatar Jan 25 '22 22:01 Lasering

Nevermind, I thought you were invoking the cli. Now looking deeper I see your are using JNA to invoke the native methods from libsass, so moving to dart-sass will probably be harder since the native methods will be diferent.

Lasering avatar Jan 27 '22 17:01 Lasering

@rwsargent, @Lasering, @danellis, @bpossolo, I've refactored sbt-sassify to include a version of dart-sass. Could you verify if this works with your setup.

To test the integration with dart-sass, take the following steps:

  1. Clone this repo
  2. Checkout the migrate_to_dart branch
  3. run sbt publishLocal in the newly cloned sbt-sassify repository
  4. In your own repository set the sbt-sassify version to "2.0.0-SNAPSHOT"
  5. Run your project as usual

Could you let me know whether this works for your setup?

irundaia avatar Feb 24 '22 20:02 irundaia

I might be doing something wrong. But for me it seems to not be working. The generated .css contains @use which should have been removed by dart-sass.

Lasering avatar Feb 25 '22 14:02 Lasering

Do you have a minimal example? Also, I might have forgotten to instruct you to use the dart compiler. >.<

Can you set the SassKeys.useDartSass := true?

irundaia avatar Feb 25 '22 14:02 irundaia

That was the missing part. Now it works.

Lasering avatar Feb 25 '22 15:02 Lasering

I'm looking into this, running into an Akka mixed dependency error which I can't seem to resolve.

rwsargent avatar Mar 14 '22 23:03 rwsargent

@rwsargent could you provide a minimal example of your setup that exhibits this behaviour?

irundaia avatar Mar 18 '22 07:03 irundaia

@irundaia we've been able to successfully using your outlined steps here, which happens to also fix a docker aarch64 libsass.so issue we were facing with the 1.x build of sbt-sassify.

Are you able to publish version 2.0.0? Even the snapshot build would be great as we're having difficulty including the local snapshot version as a plugin dependency via project/lib directory.

Edit: My colleguea informed me he had to make the following change to get the build working on macOS aarch64

- addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.3")
+ addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.5")

thadamski avatar Jul 28 '22 15:07 thadamski

@irundaia When I set cssStyle to Minified the generated css has errors, I'm not sure if they are coming from sbt-sass or from sass it self.

Lasering avatar Jul 28 '22 16:07 Lasering

@irundaia Any update on this, can the dart-sass branch be merged in and released?

leedsalex avatar Oct 12 '22 12:10 leedsalex