brackets-sass
brackets-sass copied to clipboard
keep comments and compress css
i wanted to compress my css file and also want to keep those comment's I wrote in SCSS files. It seems there is no situation like this. here's my .json file:
{
"path": {
"assets/scss/*.scss": {
"sass.enabled": true,
"sass.options": {
"outputDir": "../css/",
"imagePath": null,
"includePaths": [],
"sourceComments": false,
"outputStyle": "compressed",
"sourceMap": false
},
"linting.collapsed": false,
"fonts.fontSize": "14px",
"useTabChar": false
}
}
}
This is logical, because the compressed CSS file is illegible (or extremely hard to read), so what's the benefit of comments in that?
If you want to preserve comments /*…*/
you need to choose any output style but not compressed
.
compact
is the lightest.
@Rafiozoo basically comments are used to give information of something in some situation. in SASS u could use variable in comments as well as some other thing as SASS Documentation said. and beside, i want to keep some comment in CSS files cause other team guys that doesn't use SASS can understand some styles. I know this is possible to keep comment with choose other output, but the worse thing is it add a line comment to ease style selector.
You mean a line like that?
/* line ###, C:/path/to/your/project/scss/style.scss */
@Rafiozoo exactly! I don't want a line of comment added before each style and of course I want to keep some of my comments I think it will be so good to have options for output(compress,...) and preserving some comments together
Hmmm, it's strange. Those are the source comments. Are you sure that in your .brackets.json (in your project's root folder) is really "sourceComments": false
? I've tested your .json, and all settings are regarded properly.
Other matter, you won't get your own comments in compressed
style, unless you hack Brackets Sass (libSass exactly) ;)
I recommend nested
for reading purposes.
I advise you using task runners, like Gulp or Grunt. At single save on Sass file you can get two versions of CSS files, deployed in development version (legible code) and compressed one. With these task runners you can do much more – awesome things! :)
@Rafiozoo of course it is not keep comment now, cause I choose "false", but I wonder is that possible for compress and comments together Grunt is good suggestion, maybe I should choose one of this method for readability tanx
I know this question is old, but i was searching and end up in this issue, so this is the solution i found:
https://blog.jim-nielsen.com/2013/preserving-css-comments-during-compression/