Install
As a binary, as a library, or as a browser package.
The command-line binary
cargo install accent-sass
That gives you accent-sass, which takes the same arguments as sass for the
options both support:
accent-sass input.scss output.css
The library
[dependencies]
accent-sass = "0.16.0"
The commandline feature is on by default and pulls in clap to build the
binary. A library dependency does not need it:
[dependencies]
accent-sass = { version = "0.16.0", default-features = false, features = ["random"] }
Keep random unless you know you do not want it: dropping it removes
math.random(), random(), string.unique-id() and unique-id() from the
build, and a stylesheet that calls one of them then fails to compile.
Cargo features lists the rest.
Track unreleased work
Accent CMS pins a revision of this repository rather than a crates.io release, and you can do the same:
[dependencies]
accent-sass = { git = "https://github.com/zoosky/accent-sass.git", rev = "<commit>" }
The browser package
The browser package is published to npm as
@zoosky/accent-sass,
at the same version as the crates:
npm install @zoosky/accent-sass
It is an ES module for the web target, with an init() that fetches the
.wasm, so it runs in a browser or through a bundler, not from a plain Node
require().
To build it from a checkout instead, use
wasm-pack:
rustup target add wasm32-unknown-unknown wasm-pack build crates/lib --release --target web --out-name index -- \ --no-default-features --features wasm-exports,random
wasm-exports is not a default feature, and the build is quietly useless
without it: wasm-bindgen exports nothing, every symbol is dead code, and you
get a 0.2 MB module with no compiler in it. With the feature, the module is
1.72 MB, or 0.62 MB gzipped.
In a browser covers using it.
Requirements
The minimum supported Rust version is 1.96.1, which is what CI pins for the
gating jobs. There is no C toolchain, no Node, and no libsass anywhere in the
dependency tree.