WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 months ago

#17340 closed enhancement (wontfix)

Mark up script-loader.php versions for programmatic updating

Reported by: markjaquith Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

Whenever we update one of our dev CSS or JS files, we have to use YUI to re-minify them, and bump their version number in script-loader.php. The YUI part can be done programmatically, but it's not quite possible to bump the script-loader.php version numbers without manual intervention. If the number strings (yyyymmdd{optional-abcd suffix}) were marked up with PHP comments in a standardized way, we could automate that step as well.

Since any script would have the file name in hand, I propose the following:

/*#wp-admin/css/wp-admin.dev.css#wp-includes/css/fake.dev.css*/'20110203b'

That is, a PHP comment block that immediately starts with a hash (#) and is followed by one or more dev URLs that the version number applies to (multiple ones separated by another hash), and immediately followed by a version string enclosed in single quotes, in the format:

/'([0-9]{4})([0-9]{2})([0-9]{2})([a-z]?)'/

Change History (6)

comment:1 scribu3 years ago

I don't get it. :|

comment:2 dd323 years ago

I don't get it.

It's a syntax to allow programmatic updating of the date strings, Ie. A script can update a CSS/JS resorce file, minify it, and update any version strings which the modified files apply to.

comment:3 scribu3 years ago

Thanks, I guess I don't get the "version strings which the modified files apply to" bit.

comment:4 dd323 years ago

I guess I don't get the "version strings which the modified files apply to" bit.

Ah, Rather than processing the entire line to work out what file(s) it is, by relying upon the comment we gain a simpler processing script.. not only that, but I believe a few tinyMCE files rely on a few files to be built together to form the finalised package, so one change can affect a different "file"..

Ultimately, this will all depend on the scripts that utilise it, and given I don't know of any "in the wild", I know a few commitors do have similar scripts (And I'd say Mark has a SuperScript :))

comment:5 azaozz3 years ago

Frankly I like seeing the output from the YUI compressor and fixing the JS based on it. It doesn't just put the JS through a set of regexp, it actually runs it using Rhino and outputs some warnings or alerts if it's broken.

Last edited 3 years ago by azaozz (previous) (diff)

comment:6 nacin3 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

We have fixed this three times over since this ticket was open. Ohh yeahh. *dons shades*

Note: See TracTickets for help on using tickets.