<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Mariano Guerra's Log (Publicaciones sobre sass)</title><link>http://marianoguerra.org/</link><description></description><atom:link href="http://marianoguerra.org/es/categories/sass.xml" rel="self" type="application/rss+xml"></atom:link><language>es</language><lastBuildDate>Mon, 18 Nov 2024 17:56:29 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>SassPython - jugando con ctypes</title><link>http://marianoguerra.org/es/posts/sasspython-jugando-con-ctypes/</link><dc:creator>Mariano Guerra</dc:creator><description>&lt;section id="sasspython-bindings-for-libsass"&gt;
&lt;h2&gt;SassPython - bindings for libsass&lt;/h2&gt;
&lt;section id="why"&gt;
&lt;h3&gt;why?&lt;/h3&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;the guy on this talk asqued for it: &lt;a class="reference external" href="http://www.confreaks.com/videos/859-railsconf2012-the-future-of-sass"&gt;http://www.confreaks.com/videos/859-railsconf2012-the-future-of-sass&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I wanted to play with ctypes&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section id="who"&gt;
&lt;h3&gt;who?&lt;/h3&gt;
&lt;p&gt;marianoguerra&lt;/p&gt;
&lt;/section&gt;
&lt;section id="how"&gt;
&lt;h3&gt;how?&lt;/h3&gt;
&lt;p&gt;first of all download, compile and install libsass:&lt;/p&gt;
&lt;pre class="literal-block"&gt;git clone https://github.com/hcatlin/libsass.git
cd libsass
./configure
make
sudo make install&lt;/pre&gt;
&lt;p&gt;then you can play with this project in two ways&lt;/p&gt;
&lt;section id="command-line"&gt;
&lt;h4&gt;command line&lt;/h4&gt;
&lt;p&gt;if no options provided read from stdin:&lt;/p&gt;
&lt;pre class="literal-block"&gt;➜  src  ./sass.py
table.hl td.ln {
  text-align: right;
}

table.hl td.ln {
  text-align: right; }&lt;/pre&gt;
&lt;p&gt;from a file:&lt;/p&gt;
&lt;pre class="literal-block"&gt;➜  src  ./sass.py -f ../examples/simple.scss

.content-navigation {
  border-color: #3bbfce;
  color: darken(#3bbfce, 9%); }

.border {
  padding: 8px;
  margin: 8px;
  border-color: #3bbfce; }&lt;/pre&gt;
&lt;p&gt;from a folder:&lt;/p&gt;
&lt;img alt="http://chzscience.files.wordpress.com/2011/11/funny-science-news-experiments-memes-dog-science-fuzzy-logic.jpg" src="http://chzscience.files.wordpress.com/2011/11/funny-science-news-experiments-memes-dog-science-fuzzy-logic.jpg"&gt;
&lt;pre class="literal-block"&gt;# I think it doesn't work, never used sass before and don't know what
# this means :)
➜  src  ./sass.py -d ../examples/&lt;/pre&gt;
&lt;p&gt;you can't chew gum and walk at the same time:&lt;/p&gt;
&lt;pre class="literal-block"&gt;➜  src  ./sass.py -f ../examples/simple.scss -d ~
usage: sass.py [-h] [-f FILE_PATH | -d DIR_PATH]
sass.py: error: argument -d/--dir: not allowed with argument -f/--file&lt;/pre&gt;
&lt;/section&gt;
&lt;section id="code"&gt;
&lt;h4&gt;code&lt;/h4&gt;
&lt;p&gt;from a string:&lt;/p&gt;
&lt;pre class="literal-block"&gt;Python 2.7.3 (default, Apr 20 2012, 22:44:07)

&amp;gt;&amp;gt;&amp;gt; import sass
&amp;gt;&amp;gt;&amp;gt; STYLE = """
... table.hl td.ln {
...   text-align: right;
... }
... """

&amp;gt;&amp;gt;&amp;gt; ok, style = sass.compile(STYLE)

&amp;gt;&amp;gt;&amp;gt; ok
True

&amp;gt;&amp;gt;&amp;gt; print style
table.hl td.ln {
  text-align: right; }&lt;/pre&gt;
&lt;p&gt;from a file:&lt;/p&gt;
&lt;pre class="literal-block"&gt;&amp;gt;&amp;gt;&amp;gt; ok, style = sass.compile_path("../examples/simple.scss")

&amp;gt;&amp;gt;&amp;gt; ok
True

&amp;gt;&amp;gt;&amp;gt; print style
.content-navigation {
  border-color: #3bbfce;
  color: darken(#3bbfce, 9%); }

.border {
  padding: 8px;
  margin: 8px;
  border-color: #3bbfce; }&lt;/pre&gt;
&lt;p&gt;from a folder:&lt;/p&gt;
&lt;pre class="literal-block"&gt;&amp;gt;&amp;gt;&amp;gt; ok, style = sass.compile_folder("../examples/")

# ???
# Profit!&lt;/pre&gt;
&lt;/section&gt;
&lt;/section&gt;
&lt;section id="license"&gt;
&lt;h3&gt;license?&lt;/h3&gt;
&lt;p&gt;MIT + optional beer for the creator&lt;/p&gt;
&lt;/section&gt;
&lt;section id="what-s-left-to-do"&gt;
&lt;h3&gt;what's left to do?&lt;/h3&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;p&gt;lookup libsass more inteligently&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;python 3 support (should be easy)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;package it and submit it to pypi&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;make the folder stuff work&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;add command line options to specify option styles&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;see what the return value of the compile_* means and use it if needed&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;/section&gt;</description><guid>http://marianoguerra.org/es/posts/sasspython-jugando-con-ctypes/</guid><pubDate>Fri, 27 Jul 2012 14:58:46 GMT</pubDate></item></channel></rss>