[dev] potential optimizations: static css and javascript

Jan Schneider jan at horde.org
Wed Oct 13 14:00:55 PDT 2004


Zitat von Chuck Hagenbuch <chuck at horde.org>:

> I was thinking this evening that it might be time to give up on the html.php
> theme files and css.php processor script - it's probably just a barrier to
> theme designers to not have straight .css files, and as far as I can tell, we
> don't really use the ability to override things programattically all 
> that much
> anyway. Browser checks can be done other ways, etc. And it'd allow for better
> caching, etc. The idea would be to leave the theme config files in
> config/themes for things like graphics and whatnot, and to add a css/ 
> directory
> (name/location negotiable) to each app that'd hold top-level css files
> (screen.css, print.css, etc.) with a themes/ directory for theme-specific
> versions of those. We'd include two stylesheets (horde and app) explicitly in
> apps that added their own css, but that's not a problem that I can see.

While I like this idea generally, I see some problems that are not easy to
circumvent with static CSS files, namely style sheets that use images,
like:

$css['body']['background-image'] = "url('" . $registry->getParam('graphics',
'horde') . "/themes/kolab/bg.png')";

I can't really imagine dropping this design feature. Uh, wait, isn't the url
relative to the CSS file?

> While I was at it, it seemed prudent to add a js/ directory as well for .js
> files that really are static and don't need *any* PHP; no reason to involve
> javascript.php in those.

This is already possible, but the .js files can sit in any directory, like
htmlarea.js in services/editor/htmlarea/ for example. But of course these
files need to be in an accessable directory, i.e. not in templates.

What I actually want to say is, yes, why not.

> The files that really do need PHP can stay in
> templates/javascript but be renamed to .php, and Horde::addScriptFile() can
> check the file extension to figure out where to find it.

Lost you here.

> It also occurs to me that these could both be combined into a static/ 
> directory,
> but I'm not sure I like that.

Nay.

> What do folks think? I don't think it'd be too much work to get it done (I'd
> script a bunch of it) and obviously if we're going to change how the themes
> work doing it before 3.0 release would be key.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/


More information about the dev mailing list