ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

CSS template saved as a file not imported immediately

February 16, 2008 4:45pm

Subscribe [0]
  • #1 / Feb 16, 2008 4:45pm

    David Boyer

    12 posts

    I upgraded to version 1.62, build 20080206 today and have noticed a strange issue.

    A little background:
    I normally link to my CSS files via the stylesheet global variable.

    <link rel="stylesheet" type="text/css" media="screen" href="{stylesheet=weblog/weblog_css}" />

    I also save the css template as a file, download them and edit them locally.

    The issue:
    When I upload the edited file back to the site via FTP the changes to the css template are not recognized. (i.e. Refresh the browser and the old style sheet is still being called.) However, if I open the modified css file via the control panel the changes are then recognized and then take effect.

    To get around the problem I removed the stylesheet template and just saved my CSS file as an external file. Not a big issue just a little weird.

  • #2 / Feb 17, 2008 10:31am

    Robin Sowell

    13255 posts

    I suspect it’s the caching that now goes on for the stylesheet.  If you put the link back in old style, view the rendered source.  It likely has a v.1234 added to it- that’s so the stylesheet can be cached- and when the template is edited, that cache number changes.  Thus headers tell the browser to grab a fresh copy.  I suspect the v. number doesn’t change when the files are edited directly- thus the browsers still serving up the old cache.

    Easy enough to check if that’s the case.  Do a test- make sure the change doesn’t show.  Then clear browser caches and see if it does.

    Make sense?

  • #3 / Feb 26, 2008 7:44am

    Andy Harris

    958 posts

    Don’t know if this was followed up, but I had the same issue and this is indeed the case. My stylesheet was:

    http://xxx/?css=main/general.v.1204025876

    If I edit it externally and saved it, the old stylesheet prevails. Clearing the cache or opening the file via EE and updating it does the business, but it’s a bit of a pain.

    What I find odd is that cache is set to ‘off’ on my CSS (in template preferences) so I’m unsure why it’s caching at all.

  • #4 / Feb 26, 2008 10:52am

    Robin Sowell

    13255 posts

    css is cached by the browser normally- so that’s what’s going on there.  But looks like there’s an issue with saving the templates as field- I’ll give the crew a ‘heads up’.  If nothing else, it should be documented.  (I say w/out checking the docs to be sure it isn’t!)

  • #5 / Feb 27, 2008 5:16pm

    Paul Burdick

    480 posts

    When you use the {stylesheet=weblog/weblog_css} tag, it bypasses the Template parser entirely and serves the template directly.  So, anything like the Template Preferences is ignored.  We also, upon suggestions from users, added in caching so that only when a template’s edit date changed was a new version served to the browser.  For sites with high hit rates it greatly reduces load and bandwidth.

    However, when you edit the file directly, the data in the database is not updated until you go into the Templates section.  We will have to look at the file modification date instead.  We will fix this in the next version.  In the mean time, you can switch to using the {path=""} variable for the stylesheet link and that should solve the problem.

  • #6 / Mar 15, 2008 12:45pm

    David Boyer

    12 posts

    This may obvious however switching to the {path=""} variable for the stylesheet link does solve the problem however any relative links within the CSS file are now messed up and will have to be modified. Not a biggie with Find and Replace but worth noting.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases