A minimal sample to try the basic SpiraCSS setup with vanilla Vite (no framework).
- Node.js 20+ (recommended)
npm installThe following settings are already configured in this sample:
spiracss.config.js(aliasRoots / generator / selectorPolicy)stylelint.config.jswith@spiracss/stylelint-pluginenabledvite.config.jsaliases aligned withspiracss.config.js
If not installed, please install the following extensions:
- SpiraCSS HTML to SCSS
- SpiraCSS Comment Links
npm run dev- The top page is already styled, so you can verify data-mode variant/state
- The About page is HTML-only, so you can try the SCSS generation flow
src/index.html- Styled page (Vite MPA)
- Includes examples of
data-variant/data-state/aria-*
src/about/index.html- HTML-only page (generate SCSS from here)
src/assets/css/home.scss/src/assets/css/about.scss- Page entry SCSS
src/assets/css/common.scss- Common component entry (loaded on all pages)
src/assets/css/global.scss- Global styles shared across all pages (reset/base/utility/tokens)
spiracss.config.js- SpiraCSS configuration (shared by HTML CLI / Stylelint)
spiracss-ai-agent-doc.md- AI guide (rules and decision criteria)
Since src/about/index.html contains shared header/footer, generating from the entire file as Root may include unrelated blocks.
Select <main class="about-flow"> ... </main> to generate.
For manual work, use the VS Code extension. For AI usage, you can base your flow on the HTML CLI.
- Vanilla Vite has no component system, so common parts like header/footer are duplicated in HTML in this sample.
- SCSS generation outputs to the directory where the original HTML file is located by default (common behavior for VS Code extension /
spiracss-html-to-scss).- Generating from
src/about/index.htmloutputs tosrc/about/.
- Generating from
The VS Code extension cannot specify an output directory and always outputs next to the original HTML.
- Open
src/about/index.htmland select<main class="about-flow"> ... </main> - Run
Generate SpiraCSS SCSS from Root - Files like the following are generated next to
src/about/index.html:src/about/AboutFlow.scsssrc/about/scss/*(andsrc/about/scss/index.scss)
- Move the generated root SCSS and
scss/directory together tosrc/components/(keep root and scss at the same level):src/components/pages/about/AboutFlow/AboutFlow.scsssrc/components/pages/about/AboutFlow/scss/*
- Open
src/components/pages/about/AboutFlow/AboutFlow.scssand fix the entry comment at the top if needed:- If it says
// @assets/css/index.scss, change it to// @assets/css/about.scss
- If it says
- Wire from page entry
src/assets/css/about.scss:-
Add
@use "@pages/about/AboutFlow/AboutFlow"; -
Add placement rule (example):
> .about-flow { // @pages/about/AboutFlow/AboutFlow.scss }
-
- Run
npm run lint:scssand adjust according to Stylelint instructions
- Top page (
index.html)data-variant/data-state/aria-selectedare separated in SCSS- Page layer wiring (
@relcomments) is visible
- About page
- SCSS can be generated from HTML