Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vjt/878262 to your computer and use it in GitHub Desktop.
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]
--- 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
@pablox-cl
Copy link

Would this only work for the :nested output style or for everyone?

@vjt
Copy link
Author

vjt commented Mar 21, 2011 via email

@pablox-cl
Copy link

pablox-cl commented Mar 21, 2011 via email

@vjt
Copy link
Author

vjt commented Mar 22, 2011 via email

@pablox-cl
Copy link

pablox-cl commented Mar 22, 2011 via email

@vjt
Copy link
Author

vjt commented Mar 23, 2011

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