Class PrettyPrinter
java.lang.Object
com.google.common.css.compiler.passes.CodePrinter
com.google.common.css.compiler.passes.PrettyPrinter
- All Implemented Interfaces:
CssCompilerPass
A pretty-printer for
CssTree instances. This is work in progress.
Look at PrettyPrinterTest to see what's supported.-
Constructor Summary
ConstructorsConstructorDescriptionPrettyPrinter(VisitController visitController) PrettyPrinter(VisitController visitController, CodeBuffer buffer, GssSourceMapGenerator generator) PrettyPrinter(VisitController visitController, GssSourceMapGenerator generator) -
Method Summary
Modifier and TypeMethodDescriptionprotected CssTreeVisitorcreateVisitor(VisitController visitController, CodeBuffer codeBuffer) Constructs the visitor required by the subclass.voidrunPass()setPreserveComments(boolean preserve) Whether comments in the CSS nodes are preserved in the pretty printed output.voidsetStripQuotes(boolean stripQuotes) Whether to strip quotes from certain values.Methods inherited from class com.google.common.css.compiler.passes.CodePrinter
getOutputBuffer, resetBuffer, setPreserveMarkedComments, visit
-
Constructor Details
-
PrettyPrinter
public PrettyPrinter(VisitController visitController, @Nullable CodeBuffer buffer, @Nullable GssSourceMapGenerator generator) -
PrettyPrinter
-
PrettyPrinter
-
-
Method Details
-
setStripQuotes
public void setStripQuotes(boolean stripQuotes) Whether to strip quotes from certain values. This facilitates tests that want to compare trees. -
setPreserveComments
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
-
createVisitor
Description copied from class:CodePrinterConstructs the visitor required by the subclass. This visitor'senter*methods will be called after the source map generator'sstartSourceMappingmethod and before itsendSourceMappingmethod.- Specified by:
createVisitorin classCodePrinter
-
runPass
public void runPass()- Specified by:
runPassin interfaceCssCompilerPass
-