Getting Started
Get up and running with SenangStart CSS in minutes.
CDN (Zero Build) Recommended for prototyping
The fastest way to try SenangStart — no build step required:
html
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
<!-- Just add this single script -->
<script src="https://unpkg.com/@bookklik/senangstart-css/dist/senangstart-css.min.js"></script>
</head>
<body>
<div
layout="flex col center"
space="p:big"
visual="bg:primary text:white rounded:big"
>
<h1 visual="text-size:giant font:bold">Hello SenangStart!</h1>
<p space="m-t:small">Zero config, instant styling.</p>
</div>
</body>
</html>How CDN JIT Works
- Scans DOM — Finds all
layout,space, andvisualattributes - Generates CSS — Compiles styles on-the-fly in the browser
- Injects Styles — Creates
<style>tags with compiled CSS - Watches Changes — Uses MutationObserver for dynamic updates
Custom CDN Config
html
<script type="senangstart/config">
{
"theme": {
"colors": {
"brand": "#8B5CF6",
"accent": "#EC4899"
}
}
}
</script>
<script src="https://unpkg.com/@bookklik/senangstart-css/dist/senangstart-css.min.js"></script>WARNING
CDN JIT is perfect for prototyping and learning. For production, use the CLI build for better performance.
CLI (Production) Recommended for production
Installation
bash
# Install globally
npm install -g @bookklik/senangstart-css
# Or use npx
npx @bookklik/senangstart-css initInitialize Config
bash
senangstart initThis creates senangstart.config.js in your project root.
Add to HTML
html
<head>
<link rel="stylesheet" href="./public/senangstart.css">
</head>Start Development
bash
senangstart devThis watches your files and rebuilds on changes.
Build for Production
bash
senangstart build --minifyYour First Component
Let's create a simple card:
html
<div
layout="flex col"
space="w:[320px] p:medium"
visual="bg:white rounded:big shadow:medium"
>
<div layout="flex between" space="m-b:big">
<span visual="font:bold text-size:big">Profile</span>
<span visual="text:primary">Edit</span>
</div>
<div layout="flex col" space="g:small">
<label visual="text:grey text-size:small">Username</label>
<div visual="text:dark">@senang_dev</div>
</div>
</div>What's happening:
layout="flex col"— Flexbox, vertical directionspace="w:[320px] p:medium"— 320px width, medium paddingvisual="bg:white rounded:big shadow:medium"— White background, rounded corners, shadow
Next Steps
- Tri-Attribute Syntax — Deep dive into layout, space, visual
- The Natural Scale — Understand spacing philosophy
- Configuration — Customize the theme