Hooray! I found out how a monkey corrected SASS by answering this question:
Sass mixin recursion @include loop
And now I can help too!
1) Install the compass
For this solution you will need Compass . Install it with:
gem install compass
2) Set up the compass
Create a compass.rb file in the root of your project and define the directories in which you save the SASS and CSS code, for example. g :.
css_dir = "stylesheets" sass_dir = "sass"
Create a file called remove-all-comments-monkey-patch.rb in the root of the project:
class Sass::Tree::Visitors::Perform < Sass::Tree::Visitors::Base
4) Require monkey patch from config.rb
In config.rb add:
5) Compile your project with Compass
Use compass compile to compile SASS into CSS. You can also use compass watch so that the Compass command-line tool constantly monitors your code for changes and recompiles the details you are changing.
Questions
This will not remove comments with line numbers generated by SASS. To disable them, comment out the line_comments = true in config.rb or set it to false.
To re-enable multi-line comments, just comment out the line requiring the monkey patch and do compass clean .
Do not use it! Use single-line comments with Ctrl + /.
Although this solution is portable and will work for everyone without cracking the SASS code manually, you should really consider using the IDE, which allows you to comment entire paragraphs with single-line comments using a single keystroke. For me it's Ctrl + / .
Here I shot a short video to show that using line comments is actually faster and more efficient than using multi-line comments: http://www.youtube.com/watch?feature=player_detailpage&v=DTyMAPZrwyc
Linear comments also allow you to comment on comments without breaking code.
You have the following code:
foo bar baz
And you need to comment on all of this. If you wrap it all up with /* */ ...
bar baz*/
... then you broke the code! Now you have a comment starting with /*foo and ending with bla */ , as well as a syntax error in baz*/ .
Instead, just select the entire code and press Ctrl + / (assuming you use some kind of IDE or programmer notepad), everything will be commented out immediately:
And, of course, later it can be uncommented with the same hotkey.