csscomb / sublime-csscomb

Sublime plugin for CSScomb—CSS coding style formatter
398 stars 62 forks source link

Automatic CSSComb on save #53

Open karlhorky opened 9 years ago

karlhorky commented 9 years ago

It would be useful to have an option to automate Run CSSComb on every save, rather than manually having to invoke the command.

lrobeson commented 9 years ago

+1

remillc commented 9 years ago

+1

ghost commented 9 years ago

+1

Gliptal commented 9 years ago

+1

pzi commented 9 years ago

+1

williambout commented 9 years ago

+1

abacaj commented 9 years ago

+++++++1

chris-flanagan commented 9 years ago

+1

jomarinb commented 9 years ago

+1

graylaurenm commented 9 years ago

+1

marcobiedermann commented 9 years ago

+1

lumatijev commented 9 years ago

+1

HarrisJT commented 9 years ago

+1

powelski commented 9 years ago

+2

powelski commented 9 years ago

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!

lrobeson commented 9 years ago

Whoa, I didn't know about the Hooks package, thanks for sharing your workaround!

powelski commented 9 years ago

@lrobeson You're welcome!

julianpinedayyz commented 8 years ago

@powelski This just made my day dude! Awesomeness in 3 lines of code ;)

karlhorky commented 8 years ago

I found another CSS code style formatter plugin that has autosave: https://github.com/yisibl/sublime-perfectionist

powelski commented 8 years ago

@karlhorky Too bad it doesn't sort properties. It just takes care of white characters.

JackBracken commented 8 years ago

Thanks for the link to the hooks package @powelski, made my day

lspoor commented 7 years ago

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?

lrobeson commented 7 years ago

@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" } ] }

htmlpluscss commented 7 years ago
[
     { "keys": ["ctrl+s"], "command": "css_comb" }
]
powelski commented 7 years ago

@htmlpluscss on_pre_save_language is better solution, because you keep your saving keyboard shortcut in one place, instead of repeating it.