GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - OpenSayad/butcss: CSS-based backend framework to write server logic in CSS syntax.

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
.husky
.husky
 
 
.vscode
.vscode
 
 
examples
examples
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.lintstagedrc.json
.lintstagedrc.json
 
 
.npmignore
.npmignore
 
 
.prettierrc
.prettierrc
 
 
AGENTS.md
AGENTS.md
 
 
README.md
README.md
 
 
SPEC.md
SPEC.md
 
 
eslint.config.mjs
eslint.config.mjs
 
 
package.json
package.json
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
pnpm-workspace.yaml
pnpm-workspace.yaml
 
 
tsconfig.json
tsconfig.json
 
 
tsdown.config.ts
tsdown.config.ts
 
 
vitest.config.ts
vitest.config.ts
 
 
write-exports.ts
write-exports.ts
 
 

Repository files navigation

butcss

A PostCSS-based backend framework that lets you write server logic in CSS syntax.

Overview

css-server parses CSS files with custom syntax and compiles them into an Express.js server. It supports:

  • HTTP routing via CSS selectors ([path="/users"]:GET)
  • SQLite database queries via sql() function
  • Request data extraction (params, query, body, headers)
  • Conditional logic via if() expressions
  • Dynamic status codes and responses

Installation

pnpm install
pnpm build

Quick Start

node dist/cli.js ./examples/crud.css

Examples live in ./examples/.

Example

@server {
  port: env(PORT, 3000);
  database: env(DATABASE, ./app.db);
}

@database {
  CREATE TABLE users (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT,
    email TEXT
  );
}

[path="/users"]:GET {
  @return json(sql("SELECT * FROM users"));
}

[path="/users/:id"]:GET {
  --id: param(:id);
  --user: sql("SELECT * FROM users WHERE id = ?", var(--id));
  @return json(if(--user: var(--user); else: { "error": "Not found" }));
}

[path="/users"]:POST {
  --name: body(name);
  --email: body(email);
  @return json(sql("INSERT INTO users (name, email) VALUES (?, ?)", var(--name), var(--email)));
}

CLI

Usage: css-server <file>

Running Tests

pnpm test

License

MIT

About

CSS-based backend framework to write server logic in CSS syntax.

Resources

Readme
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.