Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rafael 5 posts 75 karma points
    Aug 13, 2021 @ 16:26
    Rafael
    0

    Cache ClientDependency still not serve a modified CSS

    Hello.

    Please, i read a lot of posts and threads about this case but my CSS files still not updating. I perform all of this things:

    • Change the clientDependency version;
    • Add version at the end of link (e.g. test.css?v=79000);
    • Drop entire TEMP folder;
    • Drop entire Cache folder;
    • Change the "debug" attribute in Web.Config to true and false (it's false now);
    • Access directly CSS file by url and reload with CTRL+SHIFT+R. https://mysite.com/style.css?v=79000

    Please somebody have an new idea? My Umbraco version is 7.13.0.

    Thanks

  • Alex Skrypnyk 6167 posts 24147 karma points MVP 8x admin c-trib
    Aug 15, 2021 @ 09:42
    Alex Skrypnyk
    0

    Hi Rafael

    How do you render references to CSS In your code?

    Alex

  • Rafael 5 posts 75 karma points
    Aug 18, 2021 @ 18:10
    Rafael
    0

    Hi Alex. I tried by two different ways:

    1) put directly on link tag in "tradicional" way:

    <link href="/css/hotsite/camp.css" rel="stylesheet" type="text/css" media="screen">
    

    2) using link tag with @Url.Content:

    <link href="@Url.Content("~/css/hotsite/camp.css")" rel="stylesheet" type="text/css" media="screen">
    

    and the results is the same.

    If i access the full css url in the browser then i see the "cached" file instead of the modified file:

    The modified file on Umbraco

    by url

    by url alternative

    I tried again and noticed a behavior. When I create a new stylesheet resrouce then it works normally. If I do the first edit then it is updated correctly, but after that first update it no longer works.

    Thank you!

  • Alex Skrypnyk 6167 posts 24147 karma points MVP 8x admin c-trib
    Aug 19, 2021 @ 12:13
    Alex Skrypnyk
    1

    Hi Rafael

    Both ways are not using ClientDependency cache. You are experiencing browser cache.

    Pust css link like this:

    @{
         // Link in required css files
        Html.RequiresCss("~/dist/css/style.css");
    }
    

    And this is in the header of your master page:

    @Html.RenderCssHere()
    

    Thanks, Alex

  • Rafael 5 posts 75 karma points
    Aug 19, 2021 @ 14:58
    Rafael
    0

    Alex, I've modified all css calls to use ClientDependency just as you directed. I did a first test and loaded the updated css, but the newest changes still don't show up. I now have the ability to modify the "version" counter of clientDependency.config, but does that mean I have to do this on every modification?

    <link href="/DependencyHandler.axd?s=L2Nzcy9ib290c3RyYXAuY3NzOy9jc3MvZm9udGVzLmNzczs&amp;t=Css&amp;cdv=790005" type="text/css" rel="stylesheet"/>
    

    In the previous way - without ClientDependency - I still couldn't understand how the problem can be related to the browser's cache, since even when accessing from different devices, the file presented is still the "old".

    Thank you.

  • Alex Skrypnyk 6167 posts 24147 karma points MVP 8x admin c-trib
    Aug 19, 2021 @ 17:30
    Alex Skrypnyk
    0

    Diplo.GodMode package can do that

    or

    You can do that manually

    or

    This package - https://github.com/SteveEdson/bump-client-dependency

    Thanks,

    Alex

  • Rafael 5 posts 75 karma points
    Aug 19, 2021 @ 17:48
    Rafael
    0

    Alex, this is perfect for ClientDependendy. Thanks for this. I'm still with that problem about cached files instead of the modified file even when access from different or new devices.

    Sorry about this, but i don't understand how is possible to browser serve a cached file even on a totally new access.

    Thank you!

  • Alex Skrypnyk 6167 posts 24147 karma points MVP 8x admin c-trib
    Aug 19, 2021 @ 18:15
    Alex Skrypnyk
    0

    Rafael

    Files are from the server or from the cache, I don't know your installation for 100%

    I just tried to assume where it is

    Thanks,

    Alex

  • Rafael 5 posts 75 karma points
    Aug 19, 2021 @ 18:51
    Rafael
    0

    I believe it's from the server because the call is direct:

    <link href="/css/hotsite/camp.css" rel="stylesheet" type="text/css" media="screen">
    

    I will continue studying the subject of caching to understand if there is any cache configuration in IIS, Umbraco or some other host location. For now I'll keep the structure with ClientDependency.

    Thanks

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Aug 20, 2021 @ 06:54
    Huw Reddick
    0

    IIS is caching static files probably. It could also be you browser, did you clear your browser's cache?

Please Sign in or register to post replies

Write your reply to:

Draft