@a-developer-who-exists/sss-css
v1.0.0
Published
SSS — a simpler CSS language. Write .sss files with center: true instead of flexbox boilerplate.
Maintainers
Readme
SSS — Simple Style Sheets
A simpler way to write CSS. Use .sss files with intuitive properties like center: true instead of flexbox boilerplate.
Install
npm install -g @a-developer-who-exists/sss-cssOr in a project:
npm install @a-developer-who-exists/sss-cssQuick start
1. Create styles.sss:
.page {
center: true;
height-range: [100vh, 100vh];
bg: [#11111b];
font: [system-ui, sans-serif];
}
.card {
center: true;
pad: 16px;
border-r: [12px];
bg: [#1e1e2e];
}2. Link it in HTML:
<script type="module" src="/__sss__/client.js"></script>
<link rel="stylesheet" href="styles.sss" />3. Start the dev server:
sss serve .Open the URL it prints (default http://localhost:3000).
No .css file needed — SSS compiles on the fly.
CLI
# Dev server (compiles .sss in the browser and over HTTP)
sss serve .
sss serve examples
# Compile to stdout
sss styles.sss
# Compile to a file (optional)
sss styles.sss output.cssHTML setup
When using sss serve, add this once in your HTML <head>:
<script type="module" src="/__sss__/client.js"></script>
<link rel="stylesheet" href="styles.sss" />The dev server serves the runtime at /__sss__/client.js automatically.
If you installed locally with npm, you can also use:
<script type="module" src="./node_modules/@a-developer-who-exists/sss-css/src/client.js"></script>
<link rel="stylesheet" href="styles.sss" />SSS syntax
| SSS | Compiles to |
|-----|-------------|
| center: true | flex center (both axes) |
| center: horizontal | center on X axis |
| center: vertical | center on Y axis |
| stack: true | flex column |
| row: true | flex row |
| spread: true | space-between |
| fill: true | width/height 100% |
| height-range: [10vh, 20vh] | min-height + max-height |
| font: [system-ui, sans-serif] | font-family |
| bg: [#11111b] | background |
| border-r: [12px] | border-radius |
| border: [1px solid #333] | border |
| pad: 12px | padding (all sides) |
| pad-L: 8px | padding-left |
| pad-R: 8px | padding-right |
| pad-U: 8px | padding-top |
| pad-D: 8px | padding-bottom |
| pad-L-R: 12px | padding left + right |
| pad-L-R-U: 12px | padding left + right + top |
Standard CSS properties (width, color, gap, etc.) pass through unchanged.
Programmatic use
import { compile } from "@a-developer-who-exists/sss-css";
const css = compile(`
.box {
center: true;
pad: 16px;
}
`);Publish to npm
- Update
authorandrepositoryinpackage.json - Create a GitHub repo and push the code
- Log in:
npm login - Publish:
npm publish
License
MIT
