[RFC] hook_styles_output

These event requests have either been rejected by the community or have become redundant because of code changes or other events requests.
Post Reply
Registered User
Posts: 50
Joined: Tue Dec 26, 2006 3:28 pm

[RFC] hook_styles_output

Post by Jhong »

Name: styles_output
Rationale: Generated CSS could be intercepted and modified on its way to the browser. Ideally this would happen after the CSS is generated. This could make for very flexible on-the-fly style adjustments, particularly for template integrations.

I already do this in wp-united in order to modify phpBB CSS on the fly so it can be combined with WordPress CSS without conflicts (it all happens transparently). Right now I have to attach the modification by editing style.php directly.

Placement: style.php, after the CSS is generated.
Input arguments: String $css the generated CSS; string $style the style name
Output arguments: String $css the modified CSS.

The hook system currently isn't available in style.php, and making it available there might incur some overhead -- unless this hook is bound differently from other hooks.

MODs would be expected to cache their modifications if they are expensive operations. For example, they could take an MD5 of the inbound CSS and use that as a cache key for returning a pre-generated result. (this is what I do in WP-United -- I store the generated CSS in flat files with names derived from unique keys).

User avatar
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany

Re: [RFC] hook_styles_output

Post by naderman »

Since style.php is going away anyway (see viewtopic.php?f=84&t=33456) you would probably want to suggest a hook in the new stylsheet generation code.

Post Reply