Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change indentation in Sass

Tags:

sass

ruby

How can I change indentation from 2 spaces to 4 spaces in output CSS files when using Sass? I'm using expanded style. I don't know anything about Ruby, but I have tried to read every rb file in /Library/Ruby/Gems/1.8/gems/sass-3.2.1/ on my computer.

like image 520
Matti Mehtonen Avatar asked Dec 03 '12 18:12

Matti Mehtonen


2 Answers

sass-3.2.3/lib/sass/tree/visitors/to_css.rb has a number of hard-coded double-space strings (' ') that are used for indentation. If you replace them all with four-space strings it will compile your css as you stated.

like image 104
Zach Kemp Avatar answered Sep 28 '22 08:09

Zach Kemp


The right way to change the sass indenting is to go to rubygems/gems/sass-3.x.x/lib/sass/tree/visitors/to_css.rb (or anywhere your to_css.rb file is), and edit this:

tab_str = ' ' * (@tabs + node.tabs)

like image 39
Forty Avatar answered Sep 28 '22 07:09

Forty