fscss
v1.2.5
Published
Figured Shorthand Cascading Style Sheet
Downloads
1,266
Maintainers
Readme
FSCSS
FSCSS (Figured Shorthand Cascading Style Sheets) is a lightweight, modern CSS preprocessor that extends CSS with shorthand utilities, variables, functions, and advanced transformations.
It is designed to make styling faster, reusable, and expressive — without losing standard CSS compatibility.
Core Features
FSCSS works in both:
- Browser (via CDN / API)
- Node.js (CLI / build tools)
Semantic Pattern Matching
pattern(threshold: "description", css)→ defines a fuzzy-matched style- Bare phrases in your stylesheet get matched against the closest pattern description and replaced with its CSS
pattern(
0.5:
"Hello World card",
`
border-radius: 12px;
padding: 24px;
background: linear-gradient(135deg, #667eea, #764ba2);
color: #fff;
box-shadow: 0 8px 24px rgba(0,0,0,0.25);
`)
pattern(0.6: "rounded primary button", `
border: none;
border-radius: 8px;
padding: 10px 20px;
background: #ffffff;
color: #764ba2;
font-weight: 600;
cursor: pointer;
`)Improved pattern:
pattern(0.6: "rounded primary button with color: white, bg: red", `
background: @match(background:?\s([#\w\d-_]+)) @match(bg:?\s([#\w\d-_]+));
color: @match(color:?\s([#\w\d-_]+)) @match(text:?\s([#\w\d-_]+));
border-radius: 25px;
padding: 10px 20px;
border: 2px solid;
font-weight: 700;
`)Use
.primary {
rounded primary button with color: #0BCEAE, background: midnightblue
}Reusable Logic
@define→ reusable blocks@fun→ function-style reusable properties@obj→ structured reusable style objects
@define center(elem){`
@use(elem){
display:flex;
justify-content:center;
align-items:center;
}
`}
@center(.box)Variables & Dynamic Values
$var→ standard variablesstr()→ inline expandable text variables- fallback operator →
$/var || fallback
$color: red;
.box{
color: $color!;
}Arrays/list & Data Handling
@arr→ define arrays.list,.join,.randint- loop generation
- with random
@arr colors[#1E2783, #8C29B2, #C41348]
.box{
background: @random(@arr.colors);
}Shorthand & Utilities
%n()→ apply multiple propertiesrpt()→ repeat valuescopy()→ reuse values@ext()→ extract strings
%2(width, height [: 200px;])
Dynamic & Smart helpers
@random()- dynamic valuesnum()- math evaluationcount()- number rangesinline()- remove{}width: num(89+11/4)px;
Animations & Selectors
- Keyframes shorthand
- Attribute selectors
- Vendor prefixing
$(@keyframes trans, .box, #hero .card, #dashboard .card &[3s ease-in infinite]){
from{ width:0; }
to{ width:200px; }
}Imports & Modularity
- Local & remote imports
- Alias support
- Wildcard import
@import((*) from "mymodules/style.fscss")Modules: https://github.com/fscss-ttr/fscss-modules/
Logic System
@event→ conditional stylingexec()→ debugging tools
@event theme(mode){
if mode:dark{
return: #1a1a1a;
}
el{
return: #f8f8f8;
}
} Example
@import((flex-x) from flex-control)
@arr colors[#1E2783, #8C29B2, #C41348]
.container{
@flex-x()
background: @random(@arr.colors);
}Installation
Global
npm install -g fscssLocal
npm install fscssBrowser Usage
<script src="https://cdn.jsdelivr.net/npm/fscss@latest/runtime.min.js" defer></script>Module
import xfscss from "https://cdn.jsdelivr.net/npm/fscss@latest/esm.min.js";
xfscss.reboot();
Use directly:
<link type="text/fscss" href="style.fscss">Or:
<style>
@import(exec("style.fscss"))
</style>Or:
@import((*) from "style.fscss")Use "defer" or "async" when loading the script.
What FSCSS Does
FSCSS transforms shorthand syntax into valid CSS, making your styles:
- shorter
- reusable
- dynamic
- easier to maintain
Ecosystem
- VS Code Extension (syntax + snippets)
- FSCSS Modules
- CLI Compiler
- Browser Runtime
Check out st-core.fscss
Learn More
https://fscss.devtem.org/
License
MIT © Figsh — FSCSS
