/// <summary>
        /// Creates a original CSS minifier settings
        /// </summary>
        /// <param name="settings">CSS minifier settings</param>
        /// <param name="isInlineCode">Flag for whether to create a settings for inline code</param>
        /// <returns>Original CSS minifier settings</returns>
        private static CssSettings CreateOriginalCssMinifierSettings(NUglifyCssMinificationSettings settings,
                                                                     bool isInlineCode)
        {
            var originalSettings = new CssSettings();

            MapCssSettings(originalSettings, settings);
            originalSettings.CssType = isInlineCode ? CssType.DeclarationList : CssType.FullStyleSheet;

            return(originalSettings);
        }
        /// <summary>
        /// Maps a CSS minifier settings
        /// </summary>
        /// <param name="originalSettings">Original CSS minifier settings</param>
        /// <param name="settings">CSS minifier settings</param>
        private static void MapCssSettings(CssSettings originalSettings, NUglifyCssMinificationSettings settings)
        {
            MapCommonSettings(originalSettings, settings);

            originalSettings.ColorNames = Utils.GetEnumFromOtherEnum <WmmCssColor, NuCssColor>(
                settings.ColorNames);
            originalSettings.CommentMode = Utils.GetEnumFromOtherEnum <WmmCssComment, NuCssComment>(
                settings.CommentMode);
            originalSettings.MinifyExpressions = settings.MinifyExpressions;
            originalSettings.RemoveEmptyBlocks = settings.RemoveEmptyBlocks;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a instance of original CSS parser
        /// </summary>
        /// <param name="settings">CSS minifier settings</param>
        /// <param name="isInlineCode">Flag for whether to create a CSS parser for inline code</param>
        /// <returns>Instance of original CSS parser</returns>
        private static CssParser CreateOriginalCssParserInstance(NUglifyCssMinificationSettings settings,
                                                                 bool isInlineCode)
        {
            var originalSettings = new CssSettings();

            MapCommonSettings(originalSettings, settings);
            originalSettings.ColorNames = Utils.GetEnumFromOtherEnum <WmmCssColor, NuCssColor>(
                settings.ColorNames);
            originalSettings.CommentMode = Utils.GetEnumFromOtherEnum <WmmCssComment, NuCssComment>(
                settings.CommentMode);
            originalSettings.CssType = isInlineCode ?
                                       CssType.DeclarationList : CssType.FullStyleSheet;
            originalSettings.MinifyExpressions = settings.MinifyExpressions;
            originalSettings.RemoveEmptyBlocks = settings.RemoveEmptyBlocks;

            var originalParser = new CssParser()
            {
                FileContext = string.Empty,
                Settings    = originalSettings
            };

            return(originalParser);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Constructs an instance of the NUglify CSS Minifier factory
 /// </summary>
 /// <param name="settings">Minification settings used to configure the NUglify CSS Minifier</param>
 public NUglifyCssMinifierFactory(NUglifyCssMinificationSettings settings)
 {
     MinificationSettings = settings;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Constructs an instance of the NUglify CSS Minifier
 /// </summary>
 /// <param name="settings">NUglify CSS Minifier settings</param>
 public NUglifyCssMinifier(NUglifyCssMinificationSettings settings)
 {
     _settings = settings;
 }
 /// <summary>
 /// Constructs an instance of the NUglify CSS Minifier
 /// </summary>
 /// <param name="settings">NUglify CSS Minifier settings</param>
 public NUglifyCssMinifier(NUglifyCssMinificationSettings settings)
 {
     _originalEmbeddedCssSettings = CreateOriginalCssMinifierSettings(settings, false);
     _originalInlineCssSettings   = CreateOriginalCssMinifierSettings(settings, true);
     _originalJsSettings          = new CodeSettings();
 }