[wp-trac] [WordPress Trac] #19592: Automate script and style compression and bumps
WordPress Trac
wp-trac at lists.automattic.com
Thu Mar 15 00:19:10 UTC 2012
#19592: Automate script and style compression and bumps
-------------------------+------------------
Reporter: nacin | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.4
Component: General | Version:
Severity: normal | Resolution:
Keywords: |
-------------------------+------------------
Changes (by mbijon):
* cc: mike@… (added)
Comment:
What is the preferred JS coding standard now? Currently the Codex has a
standards section & page for CSS,
http://codex.wordpress.org/WordPress_Coding_Standards#CSS, but no
equivalent on JS. Since we're using the YUI compressor I think those are
where we should start, if only to reduce errors in this build bot. As
@nacin's long warnings log shows that will require a lot of minor
refactoring of our current JS. However, this does go against past @nacin
warnings on Trac that minor refactors won't get added to the WP codebase.
(BTW, I'm game to start adding JS standards to the Codex if there is some
general agreement on YUI's standards being good for WP to start with.)
Specific to those "use only one {{{--> var <--}}}" warnings: the YUI
compressor seems to prefer variable declarations in a format like:
{{{
var useWindow=false,
coordinates=new Object(),
x=0,
y=0;
}}}
The standard I've seen more often is from JSLint/Crockford and also
happens to match WP's trend toward more-readable code:
{{{
var useWindow=false;
var coordinates=new Object();
var x=0;
var y=0;
}}}
Which is preferred, readability or reduced buildbot warnings?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19592#comment:27>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list