• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to automatically link all pages to renamed stylesheet with cache busting parameter?

Contributor ,
Nov 06, 2016 Nov 06, 2016

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!

Views

910

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 07, 2016 Nov 07, 2016
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

...

Votes

Translate

Translate
Community Expert ,
Nov 06, 2016 Nov 06, 2016

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 06, 2016 Nov 06, 2016

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 06, 2016 Nov 06, 2016

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.

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 07, 2016 Nov 07, 2016

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 07, 2016 Nov 07, 2016

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.

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 07, 2016 Nov 07, 2016

Copy link to clipboard

Copied

LATEST

Ben your a gentleman, thank you, the find & replace function works great, thats what I needed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines