ClientDependency icon indicating copy to clipboard operation
ClientDependency copied to clipboard

Should add a method to render a bundle directly

Open Shazwazza opened this issue 12 years ago • 5 comments
trafficstars

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.

Shazwazza avatar Apr 18 '13 15:04 Shazwazza

Hello, I don't understand, isn't 'Html.RequiresJsBundle("customjs1");' supposed to render a Bundle directly ?

giuunit avatar Sep 26 '16 12:09 giuunit

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.

Shazwazza avatar Sep 26 '16 12:09 Shazwazza

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 ?

giuunit avatar Sep 26 '16 12:09 giuunit

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...

Shazwazza avatar Sep 26 '16 12:09 Shazwazza

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).

jtemperv avatar Mar 12 '20 13:03 jtemperv