public 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; }
public 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); }
public static List <ParseException> Compact(string inputFile, string outputFile, string copyright, string timeStamp, CssCompactor.Options options) { if (!File.Exists(inputFile)) { throw new FileNotFoundException(String.Format("File (\"{0}\") not found.", inputFile), inputFile); } if ((options & CssCompactor.Options.Overwrite) == 0x0 && File.Exists(outputFile)) { throw new AccessViolationException(String.Format("File (\"{0}\") already exists.", outputFile)); } if (inputFile.Equals(outputFile, StringComparison.OrdinalIgnoreCase)) { throw new ApplicationException("Input and output file are set to the same path."); } FileUtility.PrepSavePath(outputFile); using (TextWriter output = File.CreateText(outputFile)) { return(CssCompactor.Compact(inputFile, null, output, copyright, timeStamp, options)); } }
public static List<ParseException> Compact(string inputFile, string outputFile, string copyright, string timeStamp, CssCompactor.Options options) { if (!File.Exists(inputFile)) { throw new FileNotFoundException(String.Format("File (\"{0}\") not found.", inputFile), inputFile); } if ((options&CssCompactor.Options.Overwrite) == 0x0 && File.Exists(outputFile)) { throw new AccessViolationException(String.Format("File (\"{0}\") already exists.", outputFile)); } if (inputFile.Equals(outputFile, StringComparison.OrdinalIgnoreCase)) { throw new ApplicationException("Input and output file are set to the same path."); } FileUtility.PrepSavePath(outputFile); using (TextWriter output = File.CreateText(outputFile)) { return CssCompactor.Compact(inputFile, null, output, copyright, timeStamp, options); } }
public override void Write(TextWriter writer, CssCompactor.Options options) { bool prettyPrint = IsPrettyPrint(options); writer.Write('@'); writer.Write(this.ident); if (!String.IsNullOrEmpty(this.value)) { writer.Write(' '); writer.Write(this.value); } if (this.block != null) { if (prettyPrint) { writer.WriteLine(); } this.block.Write(writer, options); } else { writer.Write(';'); } if (prettyPrint) { writer.WriteLine(); } }
public override void Write(TextWriter writer, CssCompactor.Options options) { bool space = false; foreach (CssString value in this.Values) { if (space) { writer.Write(" "); } else { space = true; } value.Write(writer, options); } }
public override void Write(TextWriter writer, CssCompactor.Options options) { bool prettyPrint = IsPrettyPrint(options); foreach (CssStatement statement in this.statements) { statement.Write(writer, options); if (prettyPrint) { writer.WriteLine(); } } }
public override void Write(TextWriter writer, CssCompactor.Options options) { writer.Write(this.Value); }
public override void Write(TextWriter writer, CssCompactor.Options options) { bool prettyPrint = IsPrettyPrint(options); bool comma = false; foreach (CssString selector in this.Selectors) { if (comma) { writer.Write(","); if (prettyPrint) { writer.WriteLine(); } } else { comma = true; } selector.Write(writer, options); } if (prettyPrint) { writer.WriteLine(); } writer.Write("{"); if (prettyPrint) { writer.WriteLine(); } foreach (CssDeclaration dec in this.Declarations) { dec.Write(writer, options); } writer.Write("}"); if (prettyPrint) { writer.WriteLine(); } }
protected static bool IsPrettyPrint(CssCompactor.Options options) { return (options & CssCompactor.Options.PrettyPrint) > 0; }
public abstract void Write(TextWriter writer, CssCompactor.Options options);
public override void Write(TextWriter writer, CssCompactor.Options options) { bool prettyPrint = IsPrettyPrint(options); if (prettyPrint) { writer.Write('\t'); } writer.Write(this.Property); writer.Write(':'); if (prettyPrint) { writer.Write(" "); } this.Value.Write(writer, options); writer.Write(";"); if (prettyPrint) { writer.WriteLine(); } }
public override void Write(TextWriter writer, CssCompactor.Options options) { bool prettyPrint = IsPrettyPrint(options); writer.Write('{'); if (prettyPrint) { writer.WriteLine(); } foreach (ICssValue value in this.Values) { value.Write(writer, options); } if (prettyPrint) { writer.WriteLine(); } writer.Write('}'); }
public void Write(TextWriter writer, CssCompactor.Options options) { this.StyleSheet.Write(writer, options); }