예제 #1
0
 private static void EnsureBundleSetup()
 {
     // This should not cause any issues if there's a race condition here, because duplicate adds will just be effective no-ops
     if (!_readBundleManifest)
     {
         _readBundleManifest = true;
         var bundleManifest = BundleManifest.ReadBundleManifest();
         if (bundleManifest != null)
         {
             bundleManifest.Register(BundleTable.Bundles);
         }
     }
 }
예제 #2
0
        internal static BundleManifest ReadBundleManifest(VirtualPathProvider vpp)
        {
            if (vpp == null)
            {
                return(null);
            }

            if (!vpp.FileExists(BundleManifestPath))
            {
                // If the bundle path is not user-specified and no file exists at the root, don't attempt to set up bundles.
                return(null);
            }

            VirtualFile file = vpp.GetFile(BundleManifestPath);

            using (var stream = file.Open()) {
                return(BundleManifest.ReadBundleManifest(stream));
            }
        }
예제 #3
0
        private static BundleCollection InitializeBundleCollection(OptimizationSettings settings)
        {
            BundleCollection bundleTable = settings.BundleTable ?? new BundleCollection();

            // Setup the bundle table first with manifest
            if (!String.IsNullOrEmpty(settings.BundleManifestPath))
            {
                using (var stream = File.OpenRead(settings.BundleManifestPath)) {
                    BundleManifest manifest = BundleManifest.ReadBundleManifest(stream);
                    manifest.Register(bundleTable);
                }
            }
            // Invoke the setup method second so code wins (i.e. BundleConfig.RegisterBundles)
            if (settings.BundleSetupMethod != null)
            {
                settings.BundleSetupMethod(bundleTable);
            }

            return(bundleTable);
        }