sublime-csscomb icon indicating copy to clipboard operation
sublime-csscomb copied to clipboard

Automatic CSSComb on save

Open karlhorky opened this issue 10 years ago • 25 comments

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

karlhorky avatar Feb 03 '15 23:02 karlhorky

+1

lrobeson avatar Feb 13 '15 19:02 lrobeson

+1

remillc avatar Feb 18 '15 17:02 remillc

+1

ghost avatar Mar 29 '15 01:03 ghost

+1

Gliptal avatar Apr 03 '15 21:04 Gliptal

+1

pzi avatar Apr 07 '15 07:04 pzi

+1

williambout avatar Apr 17 '15 07:04 williambout

+++++++1

abacaj avatar May 02 '15 16:05 abacaj

+1

chris-flanagan avatar May 07 '15 02:05 chris-flanagan

+1

jomarinb avatar May 21 '15 21:05 jomarinb

+1

graylaurenm avatar May 25 '15 20:05 graylaurenm

+1

marcobiedermann avatar May 28 '15 14:05 marcobiedermann

+1

lumatijev avatar Jul 02 '15 11:07 lumatijev

+1

HarrisJT avatar Jul 16 '15 05:07 HarrisJT

+2

powelski avatar Jul 18 '15 09:07 powelski

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!

powelski avatar Jul 18 '15 21:07 powelski

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

lrobeson avatar Jul 21 '15 16:07 lrobeson

@lrobeson You're welcome!

powelski avatar Jul 21 '15 17:07 powelski

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

julianpinedayyz avatar Aug 12 '15 00:08 julianpinedayyz

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

karlhorky avatar Sep 06 '15 22:09 karlhorky

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

powelski avatar Sep 07 '15 06:09 powelski

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

JackBracken avatar Sep 25 '15 09:09 JackBracken

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 avatar Apr 20 '17 13:04 lspoor

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

lrobeson avatar Apr 20 '17 17:04 lrobeson

[
     { "keys": ["ctrl+s"], "command": "css_comb" }
]

htmlpluscss avatar Jun 17 '17 12:06 htmlpluscss

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

powelski avatar Jun 21 '17 09:06 powelski