1. Shu Zong Chen
  2. zanderloo

Wiki

Clone wiki

zanderloo / Home

Zanderloo

Welcome to Zanderloo, the pure Python DSL for CSS. Zanderloo is a (distant) fork of Zoolander, redoing the core markup, adding all new functionality and features.

Why use Zanderloo?

  • Write CSS using python - take advantage of variables, logic, loops, mixins, and other programmable neatness missing in CSS.
  • Nest your styles - all child node selectors are crossed with all parent selectors if you .extend() a rule.

What does it look like?

from zanderloo import *
sheet = Stylesheet()

sheet.define_new(
    css("body", "table",
        font_face = "Helvetica, sans-serif",
    ),
    css(
        ("h1", "h2"),
        font_size = em(0.5),
        font_weight = bold,
    ),
)

print sheet.render()

Todo

  • Combiner to merge mutliple stylesheets together.
  • More flexibility in defining rules with multiple elements (e.g. margin = (px(0), px(0), px(0), px(0)) )
  • Fancy methods for color manipulation (Hex().darken() or Hex().reverse() or whatever)

Updated