public static void Init(BundleConfigCollection collection = null)
        {
            if (collection == null)
            {
                BundleConfigurationSection config;

                try
                {
                    config = (BundleConfigurationSection)WebConfigurationManager.GetSection("bundleConfig");
                }
                catch (Exception ex)
                {
                    throw new ApplicationException("Can not find section <bundleConfig> in the configuration file", ex);
                }

                var cssBundles = CreateBundleConfigs(config.CssBundles);
                var jsBundles  = CreateBundleConfigs(config.JsBundles);

                collection = new BundleConfigCollection
                {
                    IgnoreIfDebug = config.IgnoreIfDebug,
                    IgnoreIfLocal = config.IgnoreIfLocal,
                    CssBundles    = cssBundles,
                    JsBundles     = jsBundles
                };
            }

            _collection = collection;
        }
Exemple #2
0
        public static void RegisterConfigurationBundles(this BundleCollection bundles, BundleConfigCollection bundleConfigCollection = null)
        {
            BundleConfigurationManager.Init(bundleConfigCollection);

            var config = BundleConfigurationManager.GetBundleConfigCollection();

            AddBundleConfiguration <CssMinify>(bundles, config.CssBundles);
            AddBundleConfiguration <JsMinify>(bundles, config.JsBundles);
        }