Skip to content

Examples

The repository carries a dozen 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:

$ ./gradlew :examples:basic:run
$ ./gradlew :examples:webapp-spring-boot:run
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 V8 with an SLF4J logger and a runtime customizer
javet-node the Node engine with NodeModulesResolver against a local node_modules/
jackson2 / jackson3 wiring either JSON deserializer into the module resolver
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

  1. Copy the example directory out of the clone.
  2. Replace the project(":jsass…") dependencies with the coordinates from the header comment and add the repository.
  3. Replace id("jsass.example-conventions") with the plain application plugin — the convention plugin only exists inside this build, where it makes sure examples are never published.