irundaia / sbt-sassify

sbt-web plugin for Sass files
Apache License 2.0
68 stars 17 forks source link

libsass is now deprecated... move to dartsass #47

Open bpossolo opened 4 years ago

bpossolo commented 4 years ago

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.

irundaia commented 4 years ago

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.

danellis commented 3 years ago

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

irundaia commented 3 years ago

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 commented 3 years ago

@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.)

bpossolo commented 3 years ago

@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.

danellis commented 3 years ago

@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.

rwsargent commented 2 years ago

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

Lasering commented 2 years ago

@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 commented 2 years ago

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.

irundaia commented 2 years ago

@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?

Lasering commented 2 years ago

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.

irundaia commented 2 years ago

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?

Lasering commented 2 years ago

That was the missing part. Now it works.

rwsargent commented 2 years ago

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

irundaia commented 2 years ago

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

thadamski commented 2 years ago

@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")
Lasering commented 2 years ago

@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.

leedsalex commented 2 years ago

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