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
Post a Comment