Class CodePrinter

java.lang.Object
com.google.common.css.compiler.passes.CodePrinter
All Implemented Interfaces:
CssCompilerPass
Direct Known Subclasses:
CompactPrinter, PrettyPrinter, SExprPrinter

public abstract class CodePrinter extends Object implements CssCompilerPass
An abstract code-printer for CssTree instances that provides read/write access to the output buffer and performs common tasks during code generation, like creating sourcemaps.
  • Constructor Details

  • Method Details

    • createVisitor

      protected abstract CssTreeVisitor createVisitor(VisitController visitController, CodeBuffer codeBuffer)
      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.
    • visit

      protected final void visit()
    • resetBuffer

      protected final void resetBuffer()
    • getOutputBuffer

      protected final String getOutputBuffer()
    • setPreserveMarkedComments

      public void setPreserveMarkedComments(boolean preserveMarkedComments)
      Whether special comments in the CSS nodes are preserved in the printed output. Currently supported special comments are annotated with one of the following:
      • @preserve
      • @license
      • /*! (start of comment)
      Comments marked with @license will cause a special "END OF LICENSED CSS FILE" comment to be inserted when the parser moves on to a new source file. Note that some optimizations may move pieces around, so there's no guarantees the licensed file will remain entirely intact.

      Note: Comments layout is not guaranteed, since detailed position information in the input files is not preserved by the parser.