Copied to clipboard

Flag this post as spam?

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


  • Ritesh 11 posts 91 karma points
    Oct 27, 2020 @ 14:00
    Ritesh
    0

    How to render two different JS Bundles using ClientDependency - RenderJsHere()

    Hi All,

    I want to render two different bundles of javascript files using RenderJsHere().

    I have placed it at two different places on my page but it's showing all files (1st group + 2nd group of files) at both places. Can anyone please guide me on how to render two different sets of files using RenderJsHere()?

    Below is some sample code.

    Thanks,

        @inherits Umbraco.Web.Mvc.UmbracoViewPage
        @using ClientDependency.Core.Mvc
        <!DOCTYPE html>
        <html>
        <head>                        
            @Html.RenderCssHere()
    
             @{
                Html.RequiresJs("~/content/js/jquery-3.5.1.js", 1);        
             }
            @Html.RenderJsHere() ===========  **1st group of files in header**
    
        </head>
        <body>
            Some HTML here
    
            Bottom of page
    
            @{
                Html.RequiresJs("~/content/js/bootstrap.js", 1);
                Html.RequiresJs("~/content/js/jquery.lazy.js", 2);
                Html.RequiresJs("~/content/js/slick.js", 3);
                Html.RequiresJs("~/content/js/app.js", 4);
                Html.RequiresJs("~/content/js/myjs.js", 5);
            }
            @Html.RenderJsHere() **2nd group of files at last in page**
    
        </body>
        </html>
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies