Copied to clipboard

Flag this post as spam?

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


  • Alan Mitchell 57 posts 281 karma points c-trib
    Sep 27, 2019 @ 15:28
    Alan Mitchell
    0

    ClientDependency framework not rendering links - Umbraco Cloud, V8

    I've got a weird one, been struggling with it all day.

    We have a 8.1.5 Umbraco cloud site. A few packages installed but nothing unusual. web.config and clientdependency.config files are straight out of the box.

    As we're approaching go-live I tried to configure the client dependency framework to combine and minify some css files:

    Page header code looks like this:

    @{
         // Link in required css files
        Html.RequiresCss("~/dist/css/style.css");
        Html.RequiresCss("~/assets/fonts/gotham-font.css");
        Html.RequiresCssFolder("~/assets/css/live/");
    }
    
    @Html.RenderCssHere()
    

    All is well in debug mode. CssHere produces link elements:

    <link href="/dist/css/style.css?cdv=99" type="text/css" rel="stylesheet"/><link href="/assets/fonts/gotham-font.css?cdv=99" type="text/css" rel="stylesheet"/><link href="/assets/css/live/wellbeing.css?cdv=99" type="text/css" rel="stylesheet"/><link href="/assets/css/live/_readme.css?cdv=99" type="text/css" rel="stylesheet"/>
    

    When I switch debug mode off, the first hit to the page works fine, the link looks like this:

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

    But subsequent page requests render this in the html:

    <!--[Css:Name="StandardRenderer"]//-->
    

    And obviously the page is unstyled. Reset the site / touch web.config / bump up the version number of the cdf and it fixes it. - for one request! And then it goes back to this.

    This is running in the Development environment on the cloud, toggling between debug mode and not.

    Nothing in the error log. Not sure what else to do!

    Anyone seen anything similar?

  • Alan Mitchell 57 posts 281 karma points c-trib
    Sep 30, 2019 @ 08:12
    Alan Mitchell
    101

    Putting the answer to my own question, for the benefit of future googlers.

    The answer is stop looking at the problem and have a weekend off :)

    When you return with fresh eyes, you will realise that putting the @Html.RenderCssHere() call within a partial view, which is in turn called with "CachedPartial" may mean that caching gets in the way.

    Move the CDF commands up into uncached code - in my case the master page - and it works much better.

Please Sign in or register to post replies

Write your reply to:

Draft