Class CodePrinter
java.lang.Object
com.google.common.css.compiler.passes.CodePrinter
- All Implemented Interfaces:
CssCompilerPass
- Direct Known Subclasses:
CompactPrinter,PrettyPrinter,SExprPrinter
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 Summary
ConstructorsModifierConstructorDescriptionprotectedCodePrinter(VisitController visitController, CodeBuffer buffer, GssSourceMapGenerator generator) Initializes this instance from the givenVisitController, could optionally acceptCodeBufferandGssSourceMapGeneratorto use. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract CssTreeVisitorcreateVisitor(VisitController visitController, CodeBuffer codeBuffer) Constructs the visitor required by the subclass.protected final Stringprotected final voidvoidsetPreserveMarkedComments(boolean preserveMarkedComments) Whether special comments in the CSS nodes are preserved in the printed output.protected final voidvisit()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.common.css.compiler.ast.CssCompilerPass
runPass
-
Constructor Details
-
CodePrinter
protected CodePrinter(VisitController visitController, @Nullable CodeBuffer buffer, @Nullable GssSourceMapGenerator generator) Initializes this instance from the givenVisitController, could optionally acceptCodeBufferandGssSourceMapGeneratorto use.
-
-
Method Details
-
createVisitor
protected abstract CssTreeVisitor createVisitor(VisitController visitController, CodeBuffer codeBuffer) Constructs the visitor required by the subclass. This visitor'senter*methods will be called after the source map generator'sstartSourceMappingmethod and before itsendSourceMappingmethod. -
visit
protected final void visit() -
resetBuffer
protected final void resetBuffer() -
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)
Note: Comments layout is not guaranteed, since detailed position information in the input files is not preserved by the parser.
-