Copied to clipboard

Flag this post as spam?

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


  • Craig Rowe 22 posts 175 karma points
    Sep 22, 2016 @ 13:54
    Craig Rowe
    0

    Client Dependency Framework and Conditional Comments

    Often designers use

    <!--[if lte IE 8]>
    

    conditional comments to include different css depending on the internet explorer version.

    As far as I can tell the client dependency lines such as:

    @Html.RenderCssHere()
    

    render all css and even if using groups just renders the groups as separate bundles one after the other.

    Is there any way to render a single group? and so to use groups for IE versions - allowing us to have multiple RenderCssHere(group) lines between conditional comments?

  • Chris Wilson 100 posts 377 karma points
    Oct 03, 2016 @ 08:59
    Chris Wilson
    100

    Hi Craig,

    I believe this is possible by using a different renderer (you can note that the default package comes with an unused 'LazyLoadRenderer' in the ClientDependency.config).

    From what I understand you add a second renderer by using the method implementation which takes a Renderer Name as a string:

    @Html.Raw(Html.RenderCssHere("rendererName", [{"path"}])
    

    CDF Render

    I haven't had a go at getting this working myself so I can't help you with the paths aspect (I suspect it's something to do with the static PathsCollection object) but the documentation is usually a good place to go for things like that :)

    https://github.com/Shazwazza/ClientDependency/wiki

    Regards, Chris

  • Craig Rowe 22 posts 175 karma points
    Oct 05, 2016 @ 14:23
    Craig Rowe
    0

    That seems like a workaround? If there's two renderer's what if you what a third block? you have to make your own?

    It feels like a simple fix would just be an overload like:

    @Html.RenderCssHere(groupId)
    
  • Chris Wilson 100 posts 377 karma points
    Oct 18, 2016 @ 13:47
    Chris Wilson
    0

    In essence, yes - however you could always create your own renderer which does that.

  • Chris Wilson 100 posts 377 karma points
    Oct 03, 2016 @ 09:12
    Chris Wilson
    0

    While trying to answer my query on SRI in the CDF, I've come across something that should answer your question:

    https://github.com/Shazwazza/ClientDependency/wiki/Forced-Providers

    Ironically it seems that to add SRI support to the CDF, I may also have to implement my own renderer :)

    Regards, Chris.

Please Sign in or register to post replies

Write your reply to:

Draft