Exemplo n.º 1
0
        /// <summary>Initializes the default values for each fileset.</summary>
        /// <param name="defaultResourcePivots">The default resource pivots.</param>
        /// <param name="defaultPreprocessing">The default preprocessing.</param>
        /// <param name="defaultBundling">The default bundling.</param>
        protected void InitializeDefaults(ResourcePivotGroupCollection defaultResourcePivots, IDictionary <string, PreprocessingConfig> defaultPreprocessing, IDictionary <string, BundlingConfig> defaultBundling, string defaultOutputPathFormat)
        {
            // Set the default output path format
            if (!string.IsNullOrWhiteSpace(defaultOutputPathFormat))
            {
                this.OutputPathFormat = defaultOutputPathFormat;
            }

            // if we were given a default set of resource pivots, add them to the resource pivots
            if (defaultResourcePivots != null && defaultResourcePivots.Count() > 0)
            {
                foreach (var resourcePivotGroup in defaultResourcePivots)
                {
                    this.ResourcePivots.Set(resourcePivotGroup.Key, resourcePivotGroup.ApplyMode, resourcePivotGroup.Keys);
                }
            }

            // if we were given a default set of minification configs, copy them now
            if (defaultPreprocessing != null && defaultPreprocessing.Count > 0)
            {
                foreach (var configuration in defaultPreprocessing.Keys)
                {
                    this.Preprocessing[configuration] = defaultPreprocessing[configuration];
                }
            }

            // Set the default bundling
            if (defaultBundling != null && defaultBundling.Count > 0)
            {
                foreach (var configuration in defaultBundling.Keys)
                {
                    this.Bundling[configuration] = defaultBundling[configuration];
                }
            }
        }
Exemplo n.º 2
0
        internal JSFileSet(XElement jsFileSetElement, string sourceDirectory, IDictionary <string, JsMinificationConfig> defaultMinification, IDictionary <string, PreprocessingConfig> defaultPreProcessing, IDictionary <string, BundlingConfig> defaultBundling, ResourcePivotGroupCollection defaultResourcePivots, GlobalConfig globalConfig, string defaultOutputPathFormat, string configurationFile)
            : this()
        {
            Contract.Requires(jsFileSetElement != null);
            Contract.Requires(!string.IsNullOrWhiteSpace(sourceDirectory));

            this.InitializeDefaults(defaultResourcePivots, defaultPreProcessing, defaultBundling, defaultOutputPathFormat);
            this.InitializeDefaults(defaultMinification);
            var fileSetElements = this.Initialize(jsFileSetElement, globalConfig, configurationFile);

            this.Load(fileSetElements, sourceDirectory);
        }