Copied to clipboard

Flag this post as spam?

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


  • Jesper Skjønnemand 65 posts 440 karma points c-trib
    Mar 20, 2023 @ 11:11
    Jesper Skjønnemand
    0

    fix for delay in css deployment

    Hi all

    Working with Umbraco Cloud 8, it appears that css changes are deployed with some sort of delay compared to cshtml changes, which take effect immediately.

    This is really --like REALLY-- annoying, as changes to my cshtml often rely on changes to my css to make sense.

    My current workaround is to insert the new css directly in the cshtml files, as it then deploys in sync with the cshtml, but this is of course far from ideal.

    Do any of you know of a proper fix for this "out of sync" issue with css and cshtml?

    And no, it is not a browser cache issues :-)

    Best wishes Jesper

  • Amir Khan 1282 posts 2739 karma points
    May 16, 2023 @ 20:48
    Amir Khan
    0

    Did you ever find a fix for this? I'm about to copy / past the compiled CSS into the CMS as a workaround. You're doing it through the git deploy process right?

  • Jesper Skjønnemand 65 posts 440 karma points c-trib
    May 24, 2023 @ 12:13
    Jesper Skjønnemand
    0

    I found a solution to bypass the cached css: Adding a ?v=1234567890 to the css links where 1234567890 is a random number generated on page load.

    Upside: You always get a brand new version of the css. Downside: Benefits from caching css is gone.

    Best Jesper

  • Amir Khan 1282 posts 2739 karma points
    May 24, 2023 @ 19:30
    Amir Khan
    0

    Just generate a random string with razor in the template?

  • Jesper Skjønnemand 65 posts 440 karma points c-trib
    Jun 06, 2023 @ 10:49
    Jesper Skjønnemand
    0

    One option is to go completely random and force load the css file on every page view, similar to this:

    @{var random = new Random().Next(999999);}
    <link rel="stylesheet" type="text/css" href="/css/css.css?v=@random">
    

    Another option is to manually add a version number, timestamp or simillar, similar to this:

    <link rel="stylesheet" type="text/css" href="/css/css.css?v=20230606">
    

    With this option, make sure users load the most recent version of the css, without force loading on every page view.

Please Sign in or register to post replies

Write your reply to:

Draft