Browse documentation
Reference / Core concepts
Detecting classes
Tell Mono where your templates live and how to handle class names chosen at runtime.
Set the scan boundary
Paths resolve from the directory where you run Mono. Include all the locations that contain class strings. Exclusion patterns start with an exclamation mark.
export default {
content: ['./index.html', './components/**/*.{jsx,tsx}', '!./components/**/fixtures/**'],
output: './public/mono.css',
}Describe each state in full
The source scanner reads text. A lookup table makes every possible class visible at build time. Constructing a class from separate pieces can leave its CSS missing.
const tone = {
draft: "border border-neutral-300 text-neutral-700",
published: "border border-black bg-black text-white",
}
export function Status({ state }) {
return <span className={tone[state]}>{state}</span>
}Include classes supplied by external data
When a CMS supplies class names after the build, list the allowed names in safelist in your config. Rebuild and inspect the generated CSS for one of those selectors.
export default {
safelist: ['text-left', 'text-center', 'text-right'],
}