Exemplo n.º 1
0
        internal static List<ParseException> Compact(string inputFile, string inputSource, TextWriter output, string copyright, string timeStamp, CssCompactor.Options options)
        {
            if (output == null)
            {
                throw new NullReferenceException("Output TextWriter was null.");
            }

            // write out header with copyright and timestamp
            CssCompactor.WriteHeader(output, copyright, timeStamp);

            // verify, compact and write out results
            CssParser parser = new CssParser(inputFile, inputSource);
            parser.Write(output, options);

            // return any errors
            return parser.Errors;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Boolean indicating whether the file is valid css using a css parser
        /// </summary>
        /// <returns>True if css is valid, otherwise false</returns>
        public bool IsFileValidCss()
        {
            var parser = new CssParser(Content);

            try
            {
                var styleSheet = parser.StyleSheet;//Get stylesheet to invoke parsing
            }
            catch (Exception ex)
            {
                //Log exception?
                return false;
            }
            
            return !parser.Errors.Any();
        }