kss-tailwindcss
v1.1.0
Published
A Tailwind CSS powered KSS 3.x builder with static assets and a technical documentation UI.
Downloads
170
Maintainers
Readme
kss-tailwindcss
A Tailwind CSS powered builder for kss-node. It produces a static, offline-friendly documentation UI with responsive navigation, local search, theme controls, copy buttons, accessible focus states, and readable API reference pages.
The package is built for [email protected] and exports a CommonJS KSS builder from builder.js.
Install
npm install --save-dev kss@^3.1.0 kss-tailwindcssThe generated style guide is static. Consumers do not need Tailwind at runtime because the compiled theme CSS ships in kss-assets/kss-theme.css.
Configure KSS
In kss-config.json, point builder at the installed package directory:
{
"title": "Design System",
"source": "src/",
"homepage": "src/homepage.md",
"destination": "docs/",
"builder": "node_modules/kss-tailwindcss"
}KSS resolves builder values from config files as directories relative to the config file before it loads the builder module. For that reason, use node_modules/kss-tailwindcss in JSON config files.
Add a package script:
{
"scripts": {
"docs": "kss --config kss-config.json"
}
}Then build:
npm run docsProgrammatic Use
When calling KSS from JavaScript, the package name can be passed directly:
const kss = require("kss");
kss({
title: "Design System",
source: ["src/"],
homepage: "src/homepage.md",
destination: "docs/",
builder: "kss-tailwindcss",
});KSS Comments
Write ordinary KSS comments in your source files:
/*
Button
Primary action button.
Markup:
<button class="button">Save</button>
Styleguide Components.Button
*/
.button {
display: inline-flex;
}The builder renders:
- Overview and section pages
- Individual item pages
- Sidebar navigation and current-page table of contents
- Parameters, colors, examples, markup, and source links
- Deprecated, experimental, and private badges
- Empty states for sections without descriptions or markup
Static Assets
KSS copies the package's kss-assets/ directory into your configured destination.
Included assets:
kss-theme.css: compiled Tailwind CSS themekss-theme.js: search, drawer, copy buttons, theme toggle, guide toggle, and current-section highlightingfavicon.svg: default style guide icon
No CDN scripts or styles are required.
Browser Features
The generated docs include:
- Local search over the generated KSS index
- Persistent light, dark, and system theme modes
- Mobile navigation drawer
- Copy buttons for markup blocks
- Example guide toggle
- Section highlighting while scrolling
- Accessible landmarks, labels, and focus states
Customizing The Theme
The source CSS lives in src/kss-theme.css. After editing it, rebuild the compiled asset:
npm run buildTemplate changes live in index.hbs. Builder behavior and Handlebars helpers live in builder.js.
The publish package includes both the compiled assets and the Tailwind source so a downstream repo can rebuild the theme without recovering hidden files.
Package Structure
kss-tailwindcss/
builder.js
index.hbs
kss-assets/
favicon.svg
kss-theme.css
kss-theme.js
src/
kss-theme.css
package.json
README.mdDevelopment
Install dependencies:
npm installBuild the theme:
npm run buildCheck the npm package contents before publishing:
npm run pack:checkPublishing
Before publishing from the extracted repository:
- Verify
nameiskss-tailwindcss. - Update
versioninpackage.json. - Confirm
repository,bugs, andhomepagepoint to the extracted repository. - Run
npm install. - Run
npm run build. - Run
npm run pack:check. - Publish with
npm publish --access public.
Compatibility
- KSS builder API:
[email protected] - Module format: CommonJS
- Node.js: 18 or newer
- Runtime browser dependencies: none
License
ISC
