Skip to main content

CSSe to CSS export tool.

Project description

http://github.com/idlesign/pycsse

What’s that

pyCSSe is a 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 features 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;
    gap: @gap_min;
    /* A variable can reference another variable as long as the latter was previously defined. */
}

.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 variables 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. import pycsse if you want to use it as module. Use CsseParser and CssExporter classes.

  2. Exec ./pycsse.py -h from command line to get help on utility usage.

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

./pycsse.py -o my_css.css my_csse.css

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

pycsse-0.1.0.tar.gz (5.1 kB view hashes)

Uploaded Source

Supported by

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