Xerxisfy Elite Style Sheet (X2S)

26.0.1 · active · verified Tue Apr 21

Xerxisfy Elite Style Sheet (X2S) is a TypeScript-based CSS preprocessor and bundler designed for its custom `.x2s` stylesheet syntax. Currently at version 26.0.1, it actively develops and provides a robust CLI for compiling single `.x2s` files or entire directories into a single optimized CSS bundle. While no explicit release cadence is documented, the high major version suggests frequent and potentially significant updates. Key differentiators include unique features like `@context` for scoped global variables, `light(...) dark(...)` for theme baking, semantic layering via `layer:`, Xerx Guard locks (`@lock`) to prevent property overrides, and advanced container unit math (e.g., `cw`, `ch`). It also offers zero-config polyfilling for modern CSS features and automatic raster asset rewriting to WebP formats, making it a comprehensive tool for modern CSS development that extends beyond standard preprocessor capabilities like nesting, mixins, and control flow.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates installing X2S, creating a sample .x2s file, and compiling it to a minified CSS bundle with source maps in watch mode using the CLI.

mkdir my-x2s-project
cd my-x2s-project

echo '$brand: #007bff;\n@mixin button($padding: 10px 15px) { padding: $padding; border: none; border-radius: 4px; }\n.container { max-width: 960px; margin: 0 auto; }\n.btn { @include button; background-color: $brand; color: white; &:hover { background-color: darken($brand, 10%); } }\n@for $i from 1 through 5 { .col-#{$i} { width: math(100% / 5); } }' > styles/app.x2s

mkdir public

npm install xerxisfy-elite-style-sheet

npx x2s styles/app.x2s public/bundle.css --sourcemap --minify --watch

# Expected output in public/bundle.css and public/bundle.css.map after compilation
# (Press Ctrl+C to stop the watch process)

view raw JSON →