Skip to content

About

jsass

The ultimate SASS compiler for Java / the JVM.

Early development

jsass 6 is still in the early stages of development. API breaks are to be expected! The current preview is 6.0.0-alpha.1, published to the GitLab package registry — not to Maven Central.

What jsass 6 is

jsass 6 runs dart-sass, the reference Sass implementation, inside the JVM on an embedded JavaScript engine (Javet in V8 or Node.js mode). There is no sass binary to install, no external process to manage, and no libsass — which has been deprecated and is what jsass 5 was built on.

jsass does not bundle dart-sass. You decide which version is loaded and from where: a org.webjars.npm:sass WebJar on the classpath, or a plain node_modules/sass directory on disk. Upgrading Sass is a dependency bump in your build, not a jsass release.

How it differs from jsass 5

jsass 5 jsass 6
Sass implementation libsass (deprecated) dart-sass, supplied by you
Runtime native library via JNI Javet V8 or Javet Node
Compile API blocking Compiler.compileString(…) CompletableFuture<Output>, with a timeout
Sass module system @import only @use / @forward / @import
Custom functions reflection over annotated methods typed SassValue callbacks
Importers Collection<Import> apply(url, previous) dart-sass canonicalize / load
Output styles NESTED, EXPANDED, COMPACT, COMPRESSED EXPANDED, COMPRESSED
Java baseline Java 8 Java 21
Nullability undocumented JSpecify @NullMarked

Coming from jsass 5? The migration guide maps the old API onto the new one.

The modules

jsass 6 is a set of small artifacts under the io.bit3 group. You pick a compiler, a module resolver and a JSON deserializer; everything else is optional.

Artifact What it is
jsass The API: JsassCompiler, StringOptions, Output, importer / function / JSON SPI
jsass.javet Shared Javet plumbing behind both engine bindings
jsass.javet.v8.compiler JavetV8JsassCompiler — the V8 engine binding
jsass.javet.node.compiler JavetNodeJsassCompiler — the Node.js engine binding
jsass.javet.webjar-module-resolver Loads the Sass JS library from a WebJar (V8)
jsass.javet.node-modules-resolver Loads the Sass JS library from node_modules/ (Node)
jsass.webjar-importer Resolves SCSS @use / @import against WebJars
jsass.jackson2 JSON SPI implementation on Jackson 2.x
jsass.jackson3 JSON SPI implementation on Jackson 3.x

Where to go next

  • Getting started


    Add the dependencies and compile your first stylesheet.

    getting started

  • Options


    Every knob on StringOptions, and what it does.

    options

  • Engines


    V8 or Node, module resolvers, engine pools, timeouts.

    engines

  • Migration


    Coming from jsass 5? Here is the API mapping.

    migration