问题
My team is working with a vendor who prefers a 4-space hard tab to the 2-space soft tab that comes with the SASS expanded output style (I know, I know - we tried to talk them into the two-space deal, but they won't budge). We use Foreman to handle all of our compiling, so we don't have surface-level access to the sass-convert command that lets you set the indent-style during compilation.
I'm familiar with being able to change the 4 different output styles for SASS, and I know that you can change the tab style on your local environment like in this ticket, but I was wondering if there's a way to do this automatically through the config.rb file where we set the output style to start with.
回答1:
There's no such thing as "4-space hard tabs". A hard tab is just a character.
It is editor settings that decide how wide a tab should be displayed. You can set it to be two, four, eight spaces wide, and it will not alter the source code.
The matter is that SASS does support tabs for indentation, with one tab meaning one level of indentation. So there should be no problem for you.
If you're talking about the indentation of CSS files, i really don't understand why this is of any significance for your team. If you're using SASS, CSS files are not supposed to be edited and are rarely ever opened (most debugging takes place in developer tools like FireBug, are you aware of debug_info and source maps?). In production CSS is minified and all white space is purged.
Consider adopting a task runner tool like Grunt. You can leverage it to parse resulting CSS files at certain stage of the development routine cycle. You can also make use of the brilliant autoprefixer tool if you go this way.
PS Two spaces is the standard indentation for the Ruby community, which SASS is mostly a part of. You team is kinda stemming the tide.
来源:https://stackoverflow.com/questions/17218315/custom-indentation-type-for-sass-output