0
Welcome Guest! Login
0 items Join Now

How to prevent caching of edited compiled-css files?

    • Louis's Avatar
    • Louis
    • Newbie
    • Posts: 11
    • Thanks: 0

    How to prevent caching of edited compiled-css files?

    Posted 7 years 9 months ago
    • I use a custom less file. As many others I add new less code in the file every now and than. CSS files are often cached and only downloaded if there is a new version of the file. Many companies use variables behind the css extention to show the version let's say master-7e672b025b8357c06dd23d8133e9e743.css?v=20160721 (date of today or something like that).

      I managed to add ?v=20160721 in the [root]/libraries/gantry/core/gantry.class.php file and after compiling I actually see in the css-compiled directory exactly what I want.

      However, the file master-7e672b025b8357c06dd23d8133e9e743.css?v=20160721 is not part of the source code of the webpages. So I miss CSS while visiting webpages. Any suggestion how to make this work?
    • Last Edit: 7 years 9 months ago by Louis. Reason: No replies yet
    • First things first but not necessarily in that order
    • Damir's Avatar
    • Damir
    • Preeminent Rocketeer
    • Posts: 22450
    • Thanks: 2679
    • Web Developer

    Re: How to prevent caching of edited compiled-css files?

    Posted 7 years 9 months ago
    • Louis's Avatar
    • Louis
    • Newbie
    • Posts: 11
    • Thanks: 0

    Re: How to prevent caching of edited compiled-css files?

    Posted 7 years 9 months ago
    • Tnx Damir but that is an anwer to a different question. As I mentioned I already have a customer css and less files which works like you explain. I want to prevent caching these files (for less the compiled-css file) in order to serve returning visitors the update css file which currently has the same name. Any suggestions how to solve the original topic question?

      Kind regards,

      Louis
    • First things first but not necessarily in that order
    • Damir's Avatar
    • Damir
    • Preeminent Rocketeer
    • Posts: 22450
    • Thanks: 2679
    • Web Developer

    Re: How to prevent caching of edited compiled-css files?

    Posted 7 years 9 months ago
    • The files will never have the same name and every-time you save Gantry settings you can clear the cache in Gantry and all files are deleted but there is no point in doing that because the chances for the same name are zero to none 7e672b025b8357c06dd23d8133e9e743 this number is getting generated and its always different ... and returning visitors will never see the old css file if new one is present from Gantry ...
    • Available for CUSTOM WORK with Joomla, WordPress and Grav Templates and Gantry Framework!
    • Louis's Avatar
    • Louis
    • Newbie
    • Posts: 11
    • Thanks: 0

    Re: How to prevent caching of edited compiled-css files?

    Posted 7 years 9 months ago
    • That still does not answer the question. I am not changing anything in the Gantry settings. I want to add less code to my customer less file. That file will be part of a compiled-css file. And the name of that last file will NOT change if I add stuf in my custom-css file.

      However, your answer sounds like a work-around. Simply change 1 setting in gantry template settings and the file name will change.
      But how would this work for the custom css file that is not part of a compiled css file?
    • First things first but not necessarily in that order
    • Damir's Avatar
    • Damir
    • Preeminent Rocketeer
    • Posts: 22450
    • Thanks: 2679
    • Web Developer

    Re: How to prevent caching of edited compiled-css files?

    Posted 7 years 9 months ago
    • That file [TEMPLATE]-custom.css. does not get cached its always reloaded when user visits a page ... the thing you are trying to do is rather complicated this would require to rewrite some stuff in gantry to add date next to the file name and to load that in the code when new stuff is added ... but what if you will use RokBooster or similar stuff for caching and optimization then this doesn't make sense ....
    • Available for CUSTOM WORK with Joomla, WordPress and Grav Templates and Gantry Framework!

Time to create page: 0.041 seconds