DEV Community

Omonire Oghene-Ovie Great
Omonire Oghene-Ovie Great

Posted on

Tailwind without utility soup: semantic CSS for Python web apps

I maintain fscss, a Python wrapper around FSCSS, and we just shipped 0.2.0 on PyPI and GitHub.

The idea is simple: keep semantic CSS, but remove the repetitive parts.

The problem

Most Python web projects end up in one of two places:

  • Hand-written CSS that grows into a wall of repeated spacing, colors, and mixin-like patterns.
  • A utility-class framework that moves styling into templates and adds a frontend build pipeline.

Neither feels great when the app is Flask, Django, or FastAPI + HTMX and you want plain CSS out.

What FSCSS looks like

$accent: #8f6bff;
$ink: #0b0a13;

@define panel(sel:.panel){`
  @use(sel) {
    px: 24px;
    py: 20px;
    rounded: 16px;
    shadow: 0 18px 50px rgba(0,0,0,.35);
    stack: 14px;
  }
`}

body {
  bg: $ink!;
  ff: system-ui, sans-serif;
}

@panel(.feature)
Enter fullscreen mode Exit fullscreen mode

That compiles to ordinary CSS before the server starts. No runtime styles, no class-name generator, no injected <style> tags.

The Python part

pip install fscss
fscss init
Enter fullscreen mode Exit fullscreen mode
import fscss
from flask import Flask

app = Flask(__name__)
fscss.init_flask(app)
Enter fullscreen mode Exit fullscreen mode

fscss vendors the official Node compiler (xfscss 1.2.6) and runs it for you. Node.js 20+ is still required today, but Python is the public API: compile files, compile directories, watch for changes, and check drift in CI.

The CLI also has doctor, env, build --check, clean, report, shell completion, and init that can install Node through your platform package manager.

Why 0.2.0 matters

This release focused on trust and operability:

  • meaningful exit codes
  • --check and --strict for CI
  • environment diagnostics
  • Flask/Django helpers
  • UTF-16 input handling
  • CI on Python 3.8-3.12 across Ubuntu and Windows
  • trusted publishing to PyPI with no token stored in the repo

There is also a Flask starter, a cookbook, a shorthand cheat sheet, and VS Code support from Figsh's extension.

Where it fits

FSCSS is not trying to replace Tailwind for every team. It is for developers who want:

  • semantic class names
  • design tokens and mixins
  • plain CSS output
  • a Python-first workflow
  • zero runtime cost

If that sounds like your kind of project, try the starter and tell me what breaks. Real-world .fscss files are the most useful feedback.

Top comments (4)

Collapse
 
userxnom profile image
Abdullah Naseer •

This is the exact tension I keep running into with Flask + HTMX apps — hand-written CSS turns into a wall of repeated spacing, and pulling in a utility framework drags a whole frontend build pipeline into a project that never asked for one. Compiling to plain CSS before the server starts, with zero runtime cost, is the part that sells it to me: the browser never knows FSCSS existed.

The 0.2.0 focus is telling too — meaningful exit codes and --check / --strict for CI is the kind of unglamorous trust work that decides whether a tool survives in a real pipeline. The honest caveat that Node 20+ is still required is the one thing I would watch: for a Python-first team, is that the main adoption friction, or does the vendored compiler make it invisible enough that nobody notices? And when a real-world .fscss file gets big, what breaks first — the token system or the @define panels?

Collapse
 
omonire profile image
Omonire Oghene-Ovie Great •

That's a very fair observation.

I see the Node.js requirement as one of the adoption frictions worth addressing. Vendoring the compiler makes installation and distribution easier, but it doesn't completely remove the Node 20+ requirement. My goal is to make that dependency as transparent as possible while exploring a more Python-native experience.

On scalability, I think the bigger concern is maintainability rather than raw file size. Tokens should remain predictable and reusable, while "@define" panels should make larger stylesheets easier to organise instead of becoming another source of complexity.

These are exactly the kinds of real-world questions I want FSCSS-PY to address as it matures. Appreciate you bringing them up!

Collapse
 
fscss-ttr profile image
FSCSS tutorial •

Nice work. this hits a real gap for Python-first apps that want semantic class names without adopting a JS-heavy frontend toolchain.
Congrats on the 0.2.0 release!.
Because it vendors the fscss node compiler (fscss 1.2.6), it will work well in the real world with .fscss just as the npm fscss does. Or does Python have a different hand-off?

Collapse
 
omonire profile image
Omonire Oghene-Ovie Great •

Thanks for checking this out!

Yes, the intention is to preserve the behaviour of the original FSCSS compiler. FSCSS-PY vendors the FSCSS Node compiler (v1.2.6), so the Python package acts as a bridge rather than reimplementing the compiler.

The idea is to let Python developers work with FSCSS through a Python-friendly interface while retaining the original compiler's functionality.

I'd also love to hear about any edge cases you encounter when using it in a real Python project.