Copied to clipboard

Flag this post as spam?

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


  • Vitaly Vasilega 62 posts 184 karma points
    May 01, 2016 @ 08:19
    Vitaly Vasilega
    0

    The ClientDependency doesn't work

    Hi, I try to use ClientDependency in my site (frontend) but I have problem with it. :(

    My steps:

    1. Created empty project
    2. Installed the Umbraco 7.4.3
    3. Went to Master.cshtml page and made changes:

    before

    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/css/fanoe.css">
    <link rel="stylesheet" type="text/css" href="/css/style.css">
    

    after

    @{
    Layout = null;
    var home = @CurrentPage.Site();
    Html.RequiresCss("~/css/bootstrap.min.css").RequiresCss("~/css/fanoe.css").RequiresCss("~/css/style.css");
    }
    

    below in the page I write:

    @{ Html.RenderCssHere(); }
    

    Unfortunately this code doesn't work.

    I don't get a link to a file with css.

    What am I doing wrong?

    Thanks!

  • Marc Goodson 2141 posts 14344 karma points MVP 8x c-trib
    May 01, 2016 @ 09:40
    Marc Goodson
    100

    Hi Vitaly

    Try:

    @Html.RenderCssHere()
    

    despite the use of the word Render in the helper name, it is not writing it out to the stream, just returning an IHtmlString.

    regards

    Marc

  • Vitaly Vasilega 62 posts 184 karma points
    May 01, 2016 @ 12:10
    Vitaly Vasilega
    0

    Hi, Marc

    You are right!

    Thank you very much.

    Vitaly.

Please Sign in or register to post replies

Write your reply to:

Draft