ClientDependency
ClientDependency copied to clipboard
Should add a method to render a bundle directly
Currently we can make components dependent on a bundle but in some cases people might want to simply render out a bundle directly. This is inline with how ASP.Net optimization works. Would be easy to make in case people want to use CDF in this manner rather than using dependencies.
Hello, I don't understand, isn't 'Html.RequiresJsBundle("customjs1");' supposed to render a Bundle directly ?
This Html.RequiresJsBundle("customjs1") just makes the current page dependent on the bundle, you'd still need to use Html.RenderJsHere to output the script tag, this task is about being able to output the script tag explicitly for a given bundle instead of for all declared dependencies for the page.
It makes sense now - I am new to this library - would an helper that contains both functions (RequiresJsBundle & RenderJsHere) do the trick or is there a part of the bigger picture that I don't see ?
Yeah, probably something like RenderJsBundleHere("customjs1")
This is more of a nice to have feature, generally RenderJsHere will do everything for you since it will render out all dependencies the correct way that you have declared for your view/control/etc...
I would like to render the Application Insights client side tracing in the <head> tag and all the rest of my components js just before </body>. I guess this would be the feature I'm looking for or is there an alternative solution with CDF or other workaround (apart from using the AI code snippet on https://github.com/microsoft/applicationinsights-js#snippet-setup-ignore-if-using-npm-setup)? (fyi inside a Umbraco v8 project).