Styles & icons

Serve plain CSS directly or use the official tailwind module to compile utility classes. Use @tola/icon to manage SVG icon sets.

Plain CSS

Publish a CSS directory through [assets].trees and link it in <head> with asset-url:

toml
[assets]
cache-busting = true
trees = [{ source = "static/styles", url-prefix = "/styles" }]
typst
#import "@tola/address:0.0.0": asset-url
#html.link(rel: "stylesheet", href: asset-url("/styles/main.css"))

Tola never rewrites url(...) inside CSS files. Relative paths inside a stylesheet at /docs/styles/main.css such as url("../fonts/inter.woff2") resolve relative to /docs/styles/, working automatically under any site.base-path.

Tailwind CSS

Official module

Install the Tailwind CSS v4 CLI in your project, then add the module:

toml
[modules.tailwind]
git = { url = "https://github.com/tola-rs/modules.git", subdir = "tailwind" }

[modules.tailwind.options]
runner = "auto"
dev = "run"

Link its output in <head> via output-url:

typst
#import "@tola/address:0.0.0": output-url
#html.link(rel: "stylesheet", href: output-url("_tola-modules/tailwind/tailwind.css"))

See Modules for input, minify, runner, and dev options.

Custom hook

When a site or theme maintains its own package.json (PostCSS, custom setup, or tailored @source globs), invoke the Tailwind CLI in [[hooks.before-build]] with dev = "reuse":

toml
[[hooks.before-build]]
name = "styles"
nu = "tools/styles.nu"
dev = "reuse"
rerun-on = { include = ["styles", "**/*.typ"], exclude = ["public", ".tola", "generated"] }
generates = ["generated/styles/site.css"]

Exclude public/, vendor/, node_modules/, and large generated reference directories from your Tailwind v4 @source directives and rerun-on globs so content-only edits do not re-trigger CSS builds unnecessarily.

SVG icons

Configure local SVG folders or remote icon presets (such as Lucide) under [icons.collections] in tola.toml or tola-module.toml:

toml
[icons.collections.ui]
source-type = "local-svg-dir"
path = "icons/ui"
toml
[icons.collections.ui]
source-type = "remote-json"
preset = "lucide"
version = "1.2.154"

Remote collections lock into tola.lock and bundle with tola vendor. Run tola inspect icons to list loaded collections and icon counts.

Render icons in Typst with @tola/icon:0.0.0:

typst
#import "@tola/icon:0.0.0": icon, icon-url

// 1. Inline SVG inheriting text color via currentColor (decorative: omits label)
#icon("ui:rocket") Quick start

// 2. Meaningful standalone icon with accessible label
#icon("ui:search", label: "Search docs")

// 3. Standalone file served via <img> (does not inherit outer CSS color)
#html.img(src: icon-url("ui:rocket"), alt: "Rocket icon")

Inside a module that declares its own icons, bind the module instance name so it never collides with site collections:

typst
#import "@tola/icon:0.0.0": icon
#import "@tola/module:0.0.0": get-module

#let ui-icon = icon.with(module: get-module().name)

Use icon-bytes("ui:rocket") when you need raw SVG bytes for image(...), such as generating custom social cards or favicons in Typst.

Search this site

Use the arrow keys to move through results.

Type to search.