Skip to main content

Astric

Next generation CSS.

 █████╗ ███████╗████████╗██████╗ ██╗ ██████╗
██╔══██╗██╔════╝╚══██╔══╝██╔══██╗██║██╔════╝
███████║███████╗   ██║   ██████╔╝██║██║     
██╔══██║╚════██║   ██║   ██╔══██╗██║██║     
██║  ██║███████║   ██║   ██║  ██║██║╚██████╗
╚═╝  ╚═╝╚══════╝   ╚═╝   ╚═╝  ╚═╝╚═╝ ╚═════╝

Table of Contents

Features

Astric is a lightweight CSS preprocessor that simplifies the way you write CSS. It offers the following features:

  • Python-like Syntax: Write CSS using a Python-like syntax.
  • Simplicity: Write clean, maintainable, and scalable CSS.
  • Optionals: Semicolons are optional. If you want to use them, you can (and is required for single-line properties).
  • Variables: Define reusable values using the $ symbol.
  • Loops: Generate repetitive CSS with ease using --for and --endfor.
  • Comments: Add comments to your Astric files.
  • Compact Output: Use the --compact flag to compact outputted CSS onto one line.

Syntax

Astric introduces a simple and powerful syntax to enhance your CSS workflow. Here are some key features:

Variables

Define reusable values using the $ symbol.

$primary-color: #3498db;
$spacing: 16px;

body
    color: $primary-color;
    margin: $spacing;

Loops

Generate repetitive CSS with ease using --for and --endfor.

--for $i from 1 to 3
    .item-$i
        width: calc(100% / $i)
--endfor

Comments

Add comments to your Astric files. Comments will be stripped out in the generated CSS.

// Singleline comment
>> Another singleline comment

These features make Astric a powerful tool for writing clean, maintainable, and scalable CSS.

Usage

To use Astric, follow these steps:

  1. Download the library:

    pip3 install Astric
    
  2. Prepare your .astr file: Create a .astr file with your Astric syntax. For example, create a file named example.astr:

    $primary-color: #3498db
    $spacing: 16px
    
    body
        color: $primary-color
        margin: $spacing
    
    --for $i from 1 to 3
        .item-$i
            width: calc(100% / $i)
    --endfor
    
  3. Run Astric: Use the Astric command to process your .astr file and generate the corresponding CSS file:

    Astric example.astr output.css
    
  4. Check the output: The generated CSS will be written to output.css. You can open this file to see the processed CSS:

    body {
        color: #3498db;
        margin: 16px;
    }
    
    .item-1 {
        width: calc(100% / 1);
    }
    .item-2 {
        width: calc(100% / 2);
    }
    .item-3 {
        width: calc(100% / 3);
    }
    
  5. Compact (optional): You can use the --compact flag to compact outputted CSS onto one line.

Metadata

Release files for astric 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for astric 1.0.0
File Size Uploaded
astric-1.0.0.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for astric 1.0.0
File Interpreter ABI Platform
astric-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.8 kB

Release files / astric-1.0.0.tar.gz

Download URL astric-1.0.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
db496d79fb0ba04f8250a295894c76bbb7f94cdc5603e3c41dadd6d152815bb0
BLAKE2b-256 checksum
How to use checksums
7d830d76ae174bce5af619e517f8fb58c24a2f11bf3b6ef69f48001b42e55bcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release files / astric-1.0.0-py3-none-any.whl

Download URL astric-1.0.0-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
195b7894c47bb83b96492322c28b87961b701868fec809b58f915885cc3a80f1
BLAKE2b-256 checksum
How to use checksums
5c691cab801594959d5277d6583924c809b8bac920a6b040364b66d72a7d41de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page