Beispiel #1
0
        /// <summary>
        /// Gets a HTML minification settings based on data from
        /// configuration files (App.config or Web.config)
        /// </summary>
        /// <returns>HTML minification settings</returns>
        public HtmlMinificationSettings GetHtmlMinificationSettings()
        {
            HtmlMinificationConfiguration htmlConfig = _wmmContext.GetCoreConfiguration().Html;

            var htmlSettings = new HtmlMinificationSettings();

            MapCommonHtmlSettings(htmlSettings, htmlConfig);
            htmlSettings.RemoveCdataSectionsFromScriptsAndStyles = htmlConfig.RemoveCdataSectionsFromScriptsAndStyles;
            htmlSettings.EmptyTagRenderMode         = htmlConfig.EmptyTagRenderMode;
            htmlSettings.RemoveOptionalEndTags      = htmlConfig.RemoveOptionalEndTags;
            htmlSettings.CollapseBooleanAttributes  = htmlConfig.CollapseBooleanAttributes;
            htmlSettings.AttributeQuotesRemovalMode = htmlConfig.AttributeQuotesRemovalMode;
            htmlSettings.RemoveJsTypeAttributes     = htmlConfig.RemoveJsTypeAttributes;
            htmlSettings.RemoveCssTypeAttributes    = htmlConfig.RemoveCssTypeAttributes;

            return(htmlSettings);
        }
Beispiel #2
0
        /// <summary>
        /// Gets a registry of CSS minifiers
        /// </summary>
        /// <returns>Registry of CSS minifiers</returns>
        public Dictionary <string, CodeMinifierInfo> GetCssMinifierRegistry()
        {
            lock (_cssMinifierRegistrySynchronizer)
            {
                if (_cssMinifierRegistry == null)
                {
                    CodeMinifierRegistrationList cssMinifierRegistrationList =
                        _wmmContext.GetCoreConfiguration().Css.Minifiers;
                    _cssMinifierRegistry = new Dictionary <string, CodeMinifierInfo>();

                    foreach (CodeMinifierRegistration cssMinifierRegistration in cssMinifierRegistrationList)
                    {
                        _cssMinifierRegistry.Add(cssMinifierRegistration.Name,
                                                 new CodeMinifierInfo(
                                                     cssMinifierRegistration.Name,
                                                     cssMinifierRegistration.DisplayName,
                                                     cssMinifierRegistration.Type));
                    }
                }
            }

            return(_cssMinifierRegistry);
        }