Skip to main content

http://github.com/idlesign/pycsse

What’s that

pyCSSe is CSSe to CSS export tool in Python, able to function both as a Python module and in command line mode.

Requirements

Python 2.5+

About CSSe

CSSe is an unofficial CSS format extension, introducing variables and class mixins to speed up CSS writting and logically organize CSS structure.

The reason for CSSe is that CSS have no such featues yet, and LESS, SASS, etc. things seem overcomplicated.

CSSe format example:

/* These are variables that can be used in place of property values. */
_vars {
    gap_min: 10px;
    gap_med: 15px;
    gap_max: 30px;
    /* Variable can reference another variable as long as the latter was previously defined. */
    gap: @gap_min;
}

.indent_left {
    /* Get value from variable `gap`. */
    margin-left: @gap;
}

.brand_box {
    background-color: @color_brand;
    margin-bottom: @gap_med;
    margin-top: @gap_min;
    color: @color_subtle;
}

/* One can declare additional variable as necessary. */
_vars {
    color_brand: #5f9ea0;
    color_subtle: #f0fff0;
}

/* Any block can borrow properties from other classes. */
blockquote {
    /* We borrow properties from `indent_left` class. */
    mix: indent_left;
    /* And we borrow properties from `brand_box` class. */
    mix: brand_box;
    margin-bottom: @gap_max;
}

The above example is translated into the following CSS:

.indent_left {
    margin-left: 10px;
}

.brand_box {
    background-color: #5f9ea0;
    margin-bottom: 15px;
    margin-top: 10px;
    color: #f0fff0;
}

blockquote {
    margin-bottom: 15px;
    margin-left: 10px;
    background-color: #5f9ea0;
    margin-top: 10px;
    color: #f0fff0;
}

Usage

  1. Do import pycsse if you want to use it as module. Use CsseParser and CssExporter classes.

  2. Put ./pycsse.py -h in command line to get help on utility usage.

Cooking hints

  • Export CSSe from my_csse.css into minified CSS file named my_css.css:

    ./pycsse.py -o my_css.css my_csse.css
  • Export all CSSe files with .csse extension from a directory into one minified CSS:

    ./pycsse.py -o my_css.css --source_ext .csse /home/user/web/my_css_dir/
  • Use watch mode to export all .css files from source directory automatically:

    ./pycsse.py -o my_auto_css.css --watch /home/user/web/my_css_dir/

Release files for pycsse 0.2.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 pycsse 0.2.0
File Size Uploaded
pycsse-0.2.0.tar.gz 5.9 kB Details

Release files / pycsse-0.2.0.tar.gz

Download URL pycsse-0.2.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
178a7cb244b2d88b9cf514e8b5c2f76baf074aebd33135702776da917b9ffc82
BLAKE2b-256 checksum
How to use checksums
6b86083ebdc9eed99f9561e6afb5b75130a409c2ba10ebe183efc998b8b6dfbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.0

1 release file

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