Examples
The repository carries fifteen runnable example projects under
examples/. They are real Gradle
subprojects with tests, built and verified by CI on every pipeline — so they never drift away from
the API.
Run any of them straight from a clone:
| Example | What it shows |
|---|---|
basic |
the smallest possible setup: compile an inline SCSS string on the V8 engine |
file-path |
compilePath(…) on a file from disk, with a source map |
custom-function |
pow($base, $exp) and a theme-color lookup, implemented in Java |
custom-importer |
an Importer serving @use "virtual:theme" from a Map |
webjar-importer |
@import "bootstrap/scss/bootstrap" resolved from a WebJar |
javet-v8 |
the V8 engine with a JavetRuntimeCustomizer passed through JavetOptions |
javet-node |
the Node engine with NodeModulesResolver against a local node_modules/ |
graaljs |
the GraalJS engine with a shared, caller-owned Polyglot Engine |
embedded |
the embedded engine: native dart-sass over the Embedded Sass Protocol, with the executable taken from -Djsass.embedded.sass-executable or PATH |
autoprefixer |
autoprefixer(true) with a consumer-built ES-module bundle of postcss and autoprefixer, served by a ~50-line custom ModuleResolver; runs on V8 and GraalJS |
jpms |
a consumer with its own module-info.java on the module path — see Java modules |
jackson2 / jackson3 |
passing either JSON deserializer explicitly instead of relying on discovery |
webapp-spring-boot |
a JsassCompiler bean and a controller serving GET /style.css |
webapp-jetty |
the same idea on embedded Jetty, without a framework |
Each example's build.gradle.kts starts with a comment block listing the Maven coordinates that
replace its project(…) dependencies — copy the project, paste the coordinates, and it builds
outside the repository unchanged.
Using one as a starter
- Copy the example directory out of the clone.
- Replace the
project(":jsass…")dependencies with the coordinates from the header comment and add the repository. - Replace
id("jsass.example-conventions")with the plainapplicationplugin — the convention plugin only exists inside this build, where it makes sure examples are never published.
embedded needs a dart-sass executable outside the repository: install a
release and put it on the PATH or pass
-Djsass.embedded.sass-executable=/path/to/sass. Inside the repository the build downloads a pinned
release for run and the tests (Linux and macOS hosts).
autoprefixer needs two more pieces from the repository root: rollup.autoprefixer.config.mjs
(with its package.json script entry) and the buildAutoprefixerBundle task that runs it — the
example's processResources packages that bundle.