Declare
A Knit declaration begins with !. Inside the braces, write the CSS properties you already know.
Write CSS directly in your templates. Keep styles beside the element they belong to, without learning a substitute language.
<button class="!{color:red} !:hover{color:green}">
Button
</button>
Install the CLI globally on Linux, macOS or Windows, or add KnitCSS directly to the NPM project you are already in.
curl -fsSL https://knitcss.com/install | bash
powershell -c "irm knitcss.com/install|iex"
Run this from the current npm project and install KnitCSS there with all batteries included.
It works out of the box with no additional configuration required for Vite and Next/Nuxt projects.
npm install https://knitcss.com/install
A Knit declaration begins with !. Inside the braces, write the CSS properties you already know.
Pseudo-classes sit naturally after the Knit marker, while direct declarations keep styles attached to the element they affect.
Use the recommended !at(...) directive for consistent project breakpoints.
Name declarations with id, then copy and override them where repetition would otherwise creep in.
Initialize a project, add a template, then compile once or keep Knit watching while you work.
Read the docs →knitcss --init<div class="!{display:grid}">knitcss --watchKnit adds a thin layer for locating declarations in templates. Selectors, properties, at-rules and nesting stay recognizably CSS.
!{property:value}Base declaration
!:hover{opacity:.8}Selector
!at(medium){display:grid}Recommended breakpoint
!copy(card){background:white}Reusable declaration