[wp-trac] [WordPress Trac] #29792: Grunt: Add a precommit task to check for CSS syntax errors

WordPress Trac noreply at wordpress.org
Fri Feb 13 17:18:34 UTC 2015


#29792: Grunt: Add a precommit task to check for CSS syntax errors
---------------------------------+------------------
 Reporter:  helen                |       Owner:
     Type:  enhancement          |      Status:  new
 Priority:  normal               |   Milestone:  4.2
Component:  Build/Test Tools     |     Version:
 Severity:  normal               |  Resolution:
 Keywords:  has-patch 4.2-early  |     Focuses:
---------------------------------+------------------

Comment (by F J Kaiser):

 Some notes I got for this ticket as my workflow involves all those tools.

  * Use one Grunt plugin for ''one'' task. Linters are good for linting,
 cleaners for cleaning, etc.
  * CSSComb should be used to define the order or CSS definitions per
 class, id, etc.
  * Linters are best used after ''each'' task has finished. Tasks can go
 wrong - seriously wrong. And Linters are there for the rescue. A stepped
 process with Linters running after each step helps debugging such problems
 in seconds. Without that: Happy debugging, there goes your beer with
 friends.

 Summed up, the "no headaches" workflow is:

 > Clean CSS files in `dev` folder
 > Lint original files (SCSS/SASS/LESS Linter)
 > Preprocess (SCSS/SASS/LESS task) to current folder
 > Lint resulting CSS > Run CSSComb in current folder
 > Lint CSS
 > Run Minification to `.cache` folder
 > Lint CSS
 > Concatenate all resulting files to `dist` folder
 > Optionally remove unused CSS definitions

 Tools like this are best served as git hooks. I know SVN, etc., but for
 those who are interested, here's
 [https://github.com/wecodemore/GitPHPHooks our Git PHP Hooks tool], the
 [https://github.com/wecodemore/GitPHPHooksLibrary accompanying library]
 and [https://github.com/wecodemore/grunt-githooks our Grunt GitHooks
 task].

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29792#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list