Created
March 20, 2011 10:46
-
-
Save vjt/878262 to your computer and use it in GitHub Desktop.
Applies to sass-3.1.0.alpha.221. Make the closing curly braces stand on their own line. - [email protected]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- lib/sass/tree/visitors/convert.rb.orig 2011-03-20 05:32:23.000000000 +0100 | |
+++ lib/sass/tree/visitors/convert.rb 2011-03-14 14:57:45.000000000 +0100 | |
@@ -21,7 +21,7 @@ | |
def visit_children(parent) | |
@tabs += 1 | |
return @format == :sass ? "\n" : " {}\n" if parent.children.empty? | |
- (@format == :sass ? "\n" : " {\n") + super.join.rstrip + (@format == :sass ? "\n" : " }\n") | |
+ (@format == :sass ? "\n" : " {\n") + super.join.rstrip + (@format == :sass ? "\n" : "\n#{' '*((@tabs-1)*2)}}\n") | |
ensure | |
@tabs -= 1 | |
end |
as you can see, output style isn't taken into account when writing out less-converted stylesheets. :)
~Marcello (via iPhone)
…On Mar 20, 2011, at 8:37 PM, PaBLoX-CL ***@***.*** wrote:
Would this only work for the :nested output style or for everyone?
##
Reply to this email directly or view it on GitHub:
https://gist.github.com/878262
I guess so =P, I was just interested to know for "academic"
purposes... (ruby enthusiast)
So, if I put "compact" output, it'll still put the bracer in a new line right?
On 21 March 2011 04:44, vjt
[email protected]
wrote:
as you can see, output style isn't taken into account when writing out less-converted stylesheets. :)
~Marcello (via iPhone)
On Mar 20, 2011, at 8:37 PM, PaBLoX-CL ***@***.*** wrote:
> Would this only work for the :nested output style or for everyone?
> ##
>
> Reply to this email directly or view it on GitHub:
> https://gist.github.com/878262
##
Reply to this email directly or view it on GitHub:
https://gist.github.com/878262
##
Pablo Olmos de Aguilera Corradini - @pablox
http://www.glatelier.org/
http://www.mozillachile.org/
http://friendfeed.com/pablox/
http://www.linkedin.com/in/pablooda/
Linux User: #456971 - http://counter.li.org/
I didn't explain myself correctly - the patched code above is evaluated only in the LESS -> SCSS conversion phase - it is not used when generating .css files from SCSS ones.
I recently migrated from LESS to SCSS - and wanted to have braces on their own line in my SCSS sources. I don't care about .css output - as I look at it rarely directly, always through the browser's developer tools. :-)
Cheers,
On Mar 21, 2011, at 11:18:34 PM, PaBLoX-CL wrote:
I guess so =P, I was just interested to know for "academic"
purposes... (ruby enthusiast)
So, if I put "compact" output, it'll still put the bracer in a new line right?
Oh, I misunderstood :(. I was trying to achieve it but in the final output.
I suppose I'll continue searching.
On 22 March 2011 07:08, vjt
[email protected]
wrote:
I didn't explain myself correctly - the patched code above is evaluated only in the LESS -> SCSS conversion phase - it is not used when generating .css files from SCSS ones.
I recently migrated from LESS to SCSS - and wanted to have braces on their own line in my SCSS sources. I don't care about .css output - as I look at it rarely directly, always through the browser's developer tools. :-)
Cheers,
On Mar 21, 2011, at 11:18:34 PM, PaBLoX-CL wrote:
> I guess so =P, I was just interested to know for "academic"
> purposes... (ruby enthusiast)
>
> So, if I put "compact" output, it'll still put the bracer in a new line right?
## ~Marcello
~ ***@***.***
~ http://www.linkedin.com/in/marcellobarnaba
~ http://sindro.me/
##
Reply to this email directly or view it on GitHub:
https://gist.github.com/878262
##
Pablo Olmos de Aguilera Corradini - @pablox
http://www.glatelier.org/
http://www.mozillachile.org/
http://friendfeed.com/pablox/
http://www.linkedin.com/in/pablooda/
Linux User: #456971 - http://counter.li.org/
For that matter, have a look at tree/visitors/to_css.rb
, around line 67 - precisely the visit_directive
method.
I'd use ruby-debug
, by adding a debugger
directive right after the two return
statements and step through the code in order to better understand and change it. But from a quick look it seems that the change to implement what you're looking for should be located at line 73.
Have fun :-)
~Marcello
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would this only work for the :nested output style or for everyone?