python-sass / README

attempt to make python version of SASS (http://sass-lang.com/)

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)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.