Skip to main content

Next generation CSS

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

astric-1.0.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

astric-1.0.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file astric-1.0.0.tar.gz.

File metadata

  • Download URL: astric-1.0.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for astric-1.0.0.tar.gz
Algorithm Hash digest
SHA256 db496d79fb0ba04f8250a295894c76bbb7f94cdc5603e3c41dadd6d152815bb0
MD5 1b850bddd7a739623366765300540f65
BLAKE2b-256 7d830d76ae174bce5af619e517f8fb58c24a2f11bf3b6ef69f48001b42e55bcf

See more details on using hashes here.

File details

Details for the file astric-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: astric-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for astric-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 195b7894c47bb83b96492322c28b87961b701868fec809b58f915885cc3a80f1
MD5 3e285a644051fd6623211815bb98d874
BLAKE2b-256 5c691cab801594959d5277d6583924c809b8bac920a6b040364b66d72a7d41de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page