Want to format your CSS with the click of a button so it is properly formatted per WordPress's coding standards?
Gary Jones has put together a configuration file for this about which he writes:
Current WP CSS coding standards for property ordering are outlined at http://make.wordpress.org/core/handbook/coding-standards/css/#property-ordering . These are too generic, so using an automated tool (via grunt, editor plugin, website (once re-done)) with unambiguous prescriptive list of individual properties is better.
Example:
Before:
After:
In this article I share how this config file can be used in Sublime Text, my favorite code editor. Thanks to Robin Cornett for kindly sharing this with me in GenesisWP chat on Slack.
Step 1
Install CSScomb package via the usual Package Control: Cmd + Shift + P (on a Mac; Ctrl + Shift + P on a PC), install packages, CSScomb.
Step 2
Go to Sublime Text â–¸ Preferences â–¸ Package Settings â–¸ CSScomb â–¸ Settings - User and paste the following:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
Thanks for this tip it was super easy to set up and works perfectly!
Thanks! easy to set up and super useful 🙂
Brilliant! I’m just starting to use Sublime. Okay, I haven’t even started yet, but installed it and watched some videos this week. It looks amazing!
I finally installed CSScomb and the configuration file but it doesn’t work. When I first tried it, I got an error message, but didn’t note it down. Now it just does nothing. I’m using Sublime Text 2 on Win7. Any ideas?
Update – the error message occurs only if I attempt to run it with code selected (otherwise nothing at all happens). It says this:
CSScomb error:
‘node’ is not recognized as an internal or external command, operable program or batch file.
From https://github.com/csscomb/sublime-csscomb#the-requirements:
Node.js can be installed from http://nodejs.org/.