Class PrettyPrinter

java.lang.Object
com.google.common.css.compiler.passes.CodePrinter
com.google.common.css.compiler.passes.PrettyPrinter
All Implemented Interfaces:
CssCompilerPass

public class PrettyPrinter extends CodePrinter implements CssCompilerPass
A pretty-printer for CssTree instances. This is work in progress. Look at PrettyPrinterTest to see what's supported.
  • Constructor Details

  • Method Details

    • setStripQuotes

      public void setStripQuotes(boolean stripQuotes)
      Whether to strip quotes from certain values. This facilitates tests that want to compare trees.
    • setPreserveComments

      public PrettyPrinter setPreserveComments(boolean preserve)
      Whether comments in the CSS nodes are preserved in the pretty printed output.

      Note: Comments layout is not guaranteed, since detailed position information in the input files is not preserved by the parser. Line breaks are added after every comment with current identation as best effort.

    • getPrettyPrintedString

      public String getPrettyPrintedString()
    • createVisitor

      protected CssTreeVisitor createVisitor(VisitController visitController, CodeBuffer codeBuffer)
      Description copied from class: CodePrinter
      Constructs the visitor required by the subclass. This visitor's enter* methods will be called after the source map generator's startSourceMapping method and before its endSourceMapping method.
      Specified by:
      createVisitor in class CodePrinter
    • runPass

      public void runPass()
      Specified by:
      runPass in interface CssCompilerPass