Source

python-sass / README.TXT

``sass`` -- A python version of SASS (http://sass-lang.com/)
==================================================================


A Python version of the SASS (http://sass-lang.com/) language.

this version should work only with python 2.6,
because of ugly _ast module in 2.5


this code

=opacity(!op)
  opacity = !op
  filter = "alpha(opacity=#{!op*100})"

.node
  +opacity(.5)
  :width 10px
  :height = 20px + 1px
  
  .inside
    :width = "#{5px}"


will be converted to python as

_sheet = Sheet()

def _m_opacity(node, op):
    node.set_prop('opacity', [op])
    node.set_prop('filter', ['alpha(opacity=%s)' % (op * 100,)])

def _n_1(parent):
    node = Node('.node', parent, _sheet)
    _m_opacity(node, 0.5)
    node.set_prop('width', ['10px'])
    node.set_prop('height', [Number(20, 'px') + Number(1, 'px')])
    
    def _n_2(parent):
        node = Node('.inside', parent, _sheet)
        node.set_prop('width', ['%s' % (Number(5, 'px'),)])
    _n_2(node)

_n_1(None)