Copy link to clipboard
Copied
This is really bugging me as Dreamweaver won't let you do it automatically.
If i try and rename my stylesheet from e.g style.css to style.css?v=1 dreamweaver won't let you add in the ? character.
If I rename it outside of dreamweaver and then use change links site wide function to link all my pages to the cache busting css file style.css?v=1
It goes through the process of saying that all the pages are updated but they dont actually update at all.
I could manually go into each site page and change the link to the stylesheet with the parameter but thats time consuming, why isn't there an automated way of doing this DW? Other web editors allow me to change my css file name with the parameter and update automatically... How can I achieve this in DW?
Please help me this driving me insane!
the reason I would change the css file name with the parameter is so that all the pages that are linked to it would update automatically.
That means that pages not linked to the new CSS files would not reflect the new styles. By not renaming the CSS file, chances are that those that have not visited the site before will see the new style rules.
I dont do php at all
When you start using features that are beyond HTML, you are sure to want to use PHP. Take a simple contact form for instance, where ser
...Copy link to clipboard
Copied
I could manually go into each site page and change the link to the stylesheet with the parameter but thats time consuming,
Instead of renaming files, if you're using PHP or similar, can you use a Server Side Include (SSI) to append to rename the CSS file in the code?
Then you just upload the new include file when you change the query string and that single file updates your entire site.
Copy link to clipboard
Copied
Hi John,
Am not using PHP, just straight HTML files. Server side stuff is a bit beyond me.. how would I go about it for simple HTML files?
Copy link to clipboard
Copied
Unless you have some complex server side caching, caching occurs in the client browser, meaning that a returning customer will have the stylesheet stored in the browser cache.
To ensure that the browser does not pull up a cached version of CSS, simply rename the link to the CSS, not the file itself. For more, have a look at Simple Cache Busting for CSS and JS | Two Six Code
Normally what I would do to rename the link is to include css_version.php file in my markup as follows
<?php include("css_version.php"); ?>
and make the link as
<link rel="stylesheet" href="global.css?v=<?php echo $cssVersion; ?>">
css_version.php would consist of one line as in
<?php $cssVersion = "3.4.2"; ?>
After that, change the version number in the included file and all is done. No renaming of files required.
Copy link to clipboard
Copied
Hi Ben,
Thanks for your input, only thing is I dont do php at all, and the reason I would change the css file name with the parameter is so that all the pages that are linked to it would update automatically. Only problem is Dreamweaver doesn't do that, like other web programs do.
What your saying is that I would have to go into each web page and or wrapping template and change the link string. That's what Im trying to avoid as that can be time consuming and error prone.
Copy link to clipboard
Copied
the reason I would change the css file name with the parameter is so that all the pages that are linked to it would update automatically.
That means that pages not linked to the new CSS files would not reflect the new styles. By not renaming the CSS file, chances are that those that have not visited the site before will see the new style rules.
I dont do php at all
When you start using features that are beyond HTML, you are sure to want to use PHP. Take a simple contact form for instance, where server-side script is a must.
What your saying is that I would have to go into each web page and or wrapping template and change the link string. That's what Im trying to avoid as that can be time consuming and error prone.
You could use the 'Search and replace' function in Dreamweaver.
Copy link to clipboard
Copied
Ben your a gentleman, thank you, the find & replace function works great, thats what I needed.