[geeklog-devel] Etag Support and Caching of CSS Files

Tom websitemaster at cogeco.net
Sat Jul 27 12:49:53 EDT 2013


I have been working on ETag support and Combining and Caching of Css files
(theme and plugins together). The idea was to have config options to enable
or disable this support. I have run into a few issues though and would like
to discuss them.

 

 

ETag Support

 

Okay I ran into some issues converting style.css.php so it can be used by
all themes.

 

1)      First thing is (which I already knew about) is assumptions have to
be made for the location of certain directories like the data directory
(where the etag is stored). When style.css.php is loaded by the browser to
return the css file we only load in the siteconfig.php (instead of
lib-common) because it is very quick and we at least get the physical drive
path to the website. From there we assume that the data directory and
public_html are the same names and located in the default position.

 

2)      I was hoping to relocate style.css.php into either the layout
directory or the public_html directory. The problem here is that some css
statements (like import and loading in images  for example background:
transparent url('./images/css/bg_header.png')    rely on the location of the
actual css file. This means we either copy style.css.php to each theme
directory (not the best since multiple copies) or we update all the file
locations in the css files to be based on the actual path from the domain
(not the best either since hard coded layout and theme directory which can
be different on some setups)

 

 

Combining and Caching CSS Files

 

Thinking about this we will also run into similar issues with plugins let
alone themes. 

 

A)     If plugins start setting background images or import other css files
we are going to run into similar issues as 2) since the plugin css file will
be expecting to be in a specific location if it references other files. I
don't think many plugins do this but I am sure there are a few. We know some
themes do this anyways so having one location for a css file when dealing
with themes and plugins is going to create possible problems.

B)      Where ever the combined css file is located that location will have
to be writable. 

 

Based on these issues I am pretty sure I am going to  forget about combining
css files.

 

For ETag support instead of offering it to all themes out of the box, I am
going to update the modern curve theme style.css.php to make it usable by
other themes with little or no changes. I will also add in a theme config
option (which basically enables or disables etag for the theme) to
functions.php and make sure the scripts class supports this. So for people
who want to add support for Etags to their theme all they would have to do
is copy over the style.css.php file to your theme directory and add the
appropriate config variable to the themes functions.php.

 

This is not the way I wanted to do it but I think for now this is the only
real solution Does this sound good to everyone or did I miss something?

 

BTW the other positive by using style.css.php is that for default themes you
will not have to copy over the css files to your new theme.

 

Thanks

 

Tom

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist8.pair.net/pipermail/geeklog-devel/attachments/20130727/46c29d4a/attachment.html>


More information about the geeklog-devel mailing list