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

WordPress Trac noreply at wordpress.org
Tue Sep 22 02:24:34 UTC 2015


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

Comment (by helen):

 Squee. :)

 Replying to [comment:40 nacin]:
 >  * `src/wp-admin/css/colors/_admin.scss:83` uses `//` as a commenting
 style. I know this is allowed in SCSS, but do these rules mandate `//`
 over `/* */`? Should we always use `/* */`, since it's ultimately CSS? I
 don't see what stylelint rule this corresponds to.

 Per @GaryJ, they are functionally different, but I'm not sure if/when we
 would have rules in our very limited use of SCSS that shouldn't be in the
 unminified compiled CSS.

 >  * I noticed the removal of spaces within parentheses. Spacing within
 parentheses is a thing WP likes to do. Can we keep them? I wonder if
 enforcing them ends up being less changes. (This would mean `function-
 parentheses-space-inside: always`.)

 Let's please keep them and allow minification to strip them for minified
 files. As with PHP and JS, it's great for readability, which is extremely
 important for development files.

 >  * The requirement for a leading 0 for a decimal value (`.1s` or `.25`)
 seems weird. They get minified out anyway. And, it seems, we omit them all
 over the place. Which is more common in our codebase? What's common in the
 real world?

 My recollection of why we went this route in our coding standards was also
 for human readability: `.` is easy to miss, `0.` less so. I'd prefer to
 add them in where missing.

 >  * `string-quotes` -- What is more common in our CSS, single quotes or
 double quotes? We already prefer single quotes in JS (unlike the jQuery
 project) and in PHP, so should we just keep using it in CSS too? Is there
 a reason to not be consistent? (I think double quotes look more natural
 when surrounding a font name, I'm just asking.)

 Double quotes somehow "feel" more right in CSS, I think possibly because
 it's a standard in many other projects. It's not just voodoo personal
 preference, promise :)

 >  * We shouldn't ignore `number-zero-length-no-unit`. Remove the units.

 Patch seems to remove them - did I miss something?

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


More information about the wp-trac mailing list