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
--forand--endfor. - Comments: Add comments to your Astric files.
- Compact Output: Use the
--compactflag 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:
-
Download the library:
pip3 install Astric
-
Prepare your
.astrfile: Create a.astrfile with your Astric syntax. For example, create a file namedexample.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 -
Run Astric: Use the
Astriccommand to process your.astrfile and generate the corresponding CSS file:Astric example.astr output.css
-
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); }
-
Compact (optional): You can use the
--compactflag 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)
| File | Size | Uploaded | |
|---|---|---|---|
| astric-1.0.0.tar.gz | 7.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|