Automatic CSSComb on save
It would be useful to have an option to automate Run CSSComb on every save, rather than manually having to invoke the command.
+1
+1
+1
+1
+1
+1
+++++++1
+1
+1
+1
+1
+1
+1
+2
As a workaround, I installed Hooks package, then added this code to my CSS syntax-specific settings:
"on_pre_save_language": [
{
"command": "css_comb"
}
]
Works like a charm!
Whoa, I didn't know about the Hooks package, thanks for sharing your workaround!
@lrobeson You're welcome!
@powelski This just made my day dude! Awesomeness in 3 lines of code ;)
I found another CSS code style formatter plugin that has autosave: https://github.com/yisibl/sublime-perfectionist
@karlhorky Too bad it doesn't sort properties. It just takes care of white characters.
Thanks for the link to the hooks package @powelski, made my day
The problem with @powelski solution is css-comb now runs on any file type I save, is there a way to limit it to css/scss/sass files?
@lspoor If you open an .scss file (or whatever syntax you want) and go to "Preferences -> Settings - Syntax Specific" and add this, it will only affect scss or whichever syntax settings file you have open:
// These settings override both User and Default settings for the SCSS syntax { "on_pre_save_language": [ { "command": "css_comb" } ] }
[
{ "keys": ["ctrl+s"], "command": "css_comb" }
]
@htmlpluscss on_pre_save_language is better solution, because you keep your saving keyboard shortcut in one place, instead of repeating it.