javascript - MVC : Is there any way to create bundles in view? -


i'm developing simple cms theme support. i'm trying find way create css , js bundles each theme.

i don't want create bundles in app_start.

something put code in _viewstart.html :

@{     layout = "~/views/shared/_layout.cshtml";      add(new scriptbundle("~/bundles/myscripts").include(                 "~/scripts/myscript1.js",                 "~/scripts/myscript2.js"));      //and on... } 

is there way this...?

eventually found answer:

system.web.optimization.bundletable.bundles .add(new scriptbundle("~/bundles/myscripts").include(...)); 

just note : if don't need create bundles in controller/view, performance manners best place create bundles in app_start.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -