[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
Jhong
Registered User
Posts: 50
Joined: Tue Dec 26, 2006 3:28 pm

[RFC] hook_styles_output

Post by Jhong » Tue Aug 24, 2010 6:50 am

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.


Notes:
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
naderman
Product Manager
Product Manager
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Karlsruhe, Germany
Contact:

Re: [RFC] hook_styles_output

Post by naderman » Thu Aug 26, 2010 4:26 pm

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