Skip to main content

CSSe to CSS export tool.

Project description

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/
    

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pycsse-0.2.0.tar.gz (5.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page