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>
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,
This isn't something you can do;
RenderJsHere
andRenderCssHere
will always spit out everything that has been registered.There is an open issue on the ClientDependency library on which this runs in Umbraco, but given it's age I don't think it's something a lot of people are looking for.
Sorry it's taken a year and a half to hear "can't be done", but would love to hear if you came up with some form of workaround.
is working on a reply...