Reputation: 343
I'm writing a mini CSS framework for myself, I use Sass to write the source code, and grunt(grunt-contrib-sass) to compile my final "framework-name.scss" to "framework-name.css".
The problem is Both "//" and "/* ... */" style comments are used in my scss files, and grunt-contrib-sass only keep "/* ... */" ones and trim the "//", and the output just don't make sense and looks ugly.
I want to config grunt-contrib-sass to either keep all comments or trim them all(I prefer keeping them all, and use cssmin to trim all comments when exporting the compressed css).
But after I read the grunt-contrib-sass docs I found out there's no way to config this option, though I could just look for other compilation tool, but I am just familiar with Grunt.
So help me out, is there some ways to achieve what I want in Grunt, or I should simply unify my comments styles in scss files? thanks!
Upvotes: 0
Views: 1134
Reputation: 7706
Your problem resides in the actual SASS converter, not the Grunt task grunt-contrib-sass
.
From the SASS language reference:
Sass supports standard multiline CSS comments with
/* */
, as well as single-line comments with//
. The multiline comments are preserved in the CSS output where possible, while the single-line comments are removed.
There is no way to configure this on the SASS converter.
The reason is that single-line comments are actually comments for the SASS code. You should describe variables and mixins with single-line comments. They are meant to be meaningful only in SASS context.
Upvotes: 2