1. Victor Kotseruba
  2. python-sass

Commits

Victor Kotseruba  committed ce31a21

readme update

  • Participants
  • Parent commits f66e29f
  • Branches default

Comments (0)

Files changed (1)

File README

View file
  • Ignore whitespace
+
 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
+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)