rust-sass-wasm
v1.104.0
Published
Sass compiled to WebAssembly via the Rust port, exposing the modern JS API.
Readme
rust-sass-wasm
The sass JS API backed by the
rust-sass compiler running on
WebAssembly — a pure-JS install with no native binary and no Sass Embedded
Protocol.
If you want the native binary instead, use
sass-embedded-rust
(the same compiler as an embedded-protocol host).
Try it in the browser: playground (runs this build locally — live CSS, source maps, and warnings/errors).
Install
npm install rust-sass-wasmRequires Node.js >=18.0.0.
Usage
import { compileString } from "rust-sass-wasm";
compileString("a {b: 1px + 2px}").css;// CommonJS
const { compileString } = require("rust-sass-wasm");String compilation (compileString, compileStringAsync) and file-based
compilation (compile, compileAsync) with importers, custom functions, the
Value classes, Logger, deprecations, NodePackageImporter, and the
Compiler API all work as in sass. The sass command line is included:
npx sass input.scss output.cssVersioning
Version tracks dart-sass (1.104.0).
Links
- Repository (compiler source).
- Architecture and build docs.
- Playground (runs this build in the browser).
License
MIT.
