asp.net mvc - Is there a method of creating a bundle of bundles? -
i load minimum number of files per page without lot of redundant code in bundleconfig.cs file.
var thirdpartyscriptbundle = new scriptbundle("~/bundle/core").include( "~/scripts/jquery-{version}.js", // jquery core "~/scripts/bootstrap.js", // bootstrap "~/scripts/knockout-{version}.js", // knockout "~/scripts/underscore.js", // underscore "~/scripts/moment.js" // moment ); bundles.add(thirdpartyscriptbundle); var page1specificscriptbundle = new scriptbundle("~/bundle/page1").include( "~/scripts/page1.js" ); bundles.add(page1specificscriptbundle); var page1mergedscriptbundle = new scriptbundle("~/bundle/page1merged") .include("~/bundle/core") .include("~/bundle/page1"); bundles.add(page1mergedscriptbundle );
unfortunately, when @scripts.render("~/bundles/page1merged")
added view, no javascript file included.
with bundletable.enableoptimizations = false
expect html include:
<script src="/scripts/jquery-2.2.0.js"></script> <script src="/scripts/bootstrap.js"></script> ... <script src="/scripts/page1.js"></script>
but html blank in spot.
with bundletable.enableoptimizations = true
, see
<script src="/bundle/page1merged"></script>
but watching network traffic, file empty.
does have solution make work? today, site has number of different pages each using unique combination of bundles. rather have each page load 7 bundles, i'd find way combine 1 script bundle , 1 css bundle per page.
i'll take alternate solution if has 1 too.
Comments
Post a Comment