grunt-wp-css

0.2.1 • Public • Published

grunt-wp-css Build Status

Format style sheets according to the WordPress CSS coding standards.

Getting Started

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' );

wpcss Task

Run this task with the grunt wpcss command.

Overview

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.

Options

options.commentSpacing

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.

options.config

Type: String
Default value: 'default'

The CSSComb configuration to use for sorting CSS properties. Possible values are default or alphabetical.

Contributors

Thanks to Gary Jones of Gamajo Tech for researching and providing the default configuration rules, among many other improvements.

Release History

0.2.1

Updated peer dependencies to support Grunt 1.0. See #13

0.2.0

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.

0.1.0

  • Initial release.

Dependents (0)

Package Sidebar

Install

npm i grunt-wp-css

Weekly Downloads

2

Version

0.2.1

License

MIT

Last publish

Collaborators

  • bradyvercher