Format style sheets according to the WordPress CSS coding standards.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-wp-css --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks( 'grunt-wp-css' );
Run this task with the grunt wpcss
command.
In your project's Gruntfile, add a section named wpcss
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
wpcss: {
target: {
options: {
commentSpacing: true, // Whether to clean up newlines around comments between CSS rules.
config: '', // Which CSSComb config to use for sorting properties.
},
files: {}
}
}
});
This task supports the file mapping format Grunt supports. Please read Globbing patterns and Building the files object dynamically for additional details.
Type: Boolean
Default value: true
Optional
Whether the plugin should attempt to automatically correct spacing around comments that appear between rule declarations within the style sheet.
Type: String
Default value: 'default'
The CSSComb configuration to use for sorting CSS properties. Possible values are default
or alphabetical
.
Thanks to Gary Jones of Gamajo Tech for researching and providing the default configuration rules, among many other improvements.
Updated peer dependencies to support Grunt 1.0. See #13
This is the @GaryJones release.
- Updated the default CSScomb config (0887c06).
- Updated the alphabetical CSScomb config to match improvements in the new default config.
- Fixed the exports variable name in the tests.
- Added Travis CI support.
- Initial release.