Package de.larsgrefer.sass.embedded
Class SassCompiler
- java.lang.Object
-
- de.larsgrefer.sass.embedded.SassCompiler
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class SassCompiler extends Object implements Closeable
- See Also:
SassCompilerFactory.bundled()
-
-
Constructor Summary
Constructors Constructor Description SassCompiler(CompilerConnection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
CompileSuccess
compile(@NonNull URL source)
CompileSuccess
compile(@NonNull URL source, com.sass_lang.embedded_protocol.OutputStyle outputStyle)
CompileSuccess
compileCssString(@NonNull String source)
CompileSuccess
compileFile(@NonNull File inputFile)
CompileSuccess
compileFile(@NonNull File file, @NonNull com.sass_lang.embedded_protocol.OutputStyle outputStyle)
protected com.sass_lang.embedded_protocol.InboundMessage.CompileRequest.Builder
compileRequestBuilder()
CompileSuccess
compileSassString(@NonNull String source)
CompileSuccess
compileScssString(@NonNull String source)
CompileSuccess
compileString(@NonNull String source, com.sass_lang.embedded_protocol.Syntax syntax, com.sass_lang.embedded_protocol.OutputStyle outputStyle)
CompileSuccess
compileString(com.sass_lang.embedded_protocol.InboundMessage.CompileRequest.StringInput string, @NonNull com.sass_lang.embedded_protocol.OutputStyle outputStyle)
CompileSuccess
compileString(String source, com.sass_lang.embedded_protocol.Syntax syntax)
List<File>
getLoadPaths()
LoggingHandler
getLoggingHandler()
com.sass_lang.embedded_protocol.OutputStyle
getOutputStyle()
How to format the CSS output.com.sass_lang.embedded_protocol.OutboundMessage.VersionResponse
getVersion()
boolean
isAlertAscii()
Whether to encode the formatted message of errors and logs in ASCII.boolean
isAlertColor()
Whether to use terminal colors in the formatted message of errors and logs.boolean
isEmitCharset()
Whether to emit a `@charset`/BOM for non-ASCII stylesheets.boolean
isGenerateSourceMaps()
Whether to generate a source map.boolean
isQuietDeps()
Whether to omit events for deprecation warnings coming from dependencies (files loaded from a different importer than the input).boolean
isSilent()
Whether to silently suppresses all`LogEvent`s
.boolean
isSourceMapIncludeSources()
Whether to include sources in the generated sourcemapboolean
isVerbose()
Whether to report all deprecation warnings or only the first few ones.void
registerFunction(@NonNull HostFunction sassFunction)
void
registerImporter(@NonNull CustomImporter customImporter)
void
registerImporter(@NonNull FileImporter fileImporter)
void
setAlertAscii(boolean alertAscii)
Whether to encode the formatted message of errors and logs in ASCII.void
setAlertColor(boolean alertColor)
Whether to use terminal colors in the formatted message of errors and logs.void
setEmitCharset(boolean emitCharset)
Whether to emit a `@charset`/BOM for non-ASCII stylesheets.void
setGenerateSourceMaps(boolean generateSourceMaps)
Whether to generate a source map.void
setLoadPaths(List<File> loadPaths)
void
setLoggingHandler(LoggingHandler loggingHandler)
void
setOutputStyle(com.sass_lang.embedded_protocol.OutputStyle outputStyle)
How to format the CSS output.void
setQuietDeps(boolean quietDeps)
Whether to omit events for deprecation warnings coming from dependencies (files loaded from a different importer than the input).void
setSilent(boolean silent)
Whether to silently suppresses all`LogEvent`s
.void
setSourceMapIncludeSources(boolean sourceMapIncludeSources)
Whether to include sources in the generated sourcemapvoid
setVerbose(boolean verbose)
Whether to report all deprecation warnings or only the first few ones.
-
-
-
Constructor Detail
-
SassCompiler
public SassCompiler(CompilerConnection connection)
-
-
Method Detail
-
getVersion
public com.sass_lang.embedded_protocol.OutboundMessage.VersionResponse getVersion() throws IOException
- Throws:
IOException
-
registerFunction
public void registerFunction(@NonNull @NonNull HostFunction sassFunction)
-
registerImporter
public void registerImporter(@NonNull @NonNull FileImporter fileImporter)
-
registerImporter
public void registerImporter(@NonNull @NonNull CustomImporter customImporter)
-
compileRequestBuilder
protected com.sass_lang.embedded_protocol.InboundMessage.CompileRequest.Builder compileRequestBuilder()
-
compile
public CompileSuccess compile(@NonNull @NonNull URL source) throws SassCompilationFailedException, IOException
-
compile
public CompileSuccess compile(@NonNull @NonNull URL source, com.sass_lang.embedded_protocol.OutputStyle outputStyle) throws SassCompilationFailedException, IOException
-
compileScssString
public CompileSuccess compileScssString(@NonNull @Language("SCSS") @NonNull String source) throws IOException, SassCompilationFailedException
-
compileSassString
public CompileSuccess compileSassString(@NonNull @Language("SASS") @NonNull String source) throws IOException, SassCompilationFailedException
-
compileCssString
public CompileSuccess compileCssString(@NonNull @Language("CSS") @NonNull String source) throws IOException, SassCompilationFailedException
-
compileString
public CompileSuccess compileString(String source, com.sass_lang.embedded_protocol.Syntax syntax) throws SassCompilationFailedException, IOException
-
compileString
public CompileSuccess compileString(@NonNull @NonNull String source, com.sass_lang.embedded_protocol.Syntax syntax, com.sass_lang.embedded_protocol.OutputStyle outputStyle) throws IOException, SassCompilationFailedException
-
compileString
@Nonnull public CompileSuccess compileString(com.sass_lang.embedded_protocol.InboundMessage.CompileRequest.StringInput string, @NonNull @NonNull com.sass_lang.embedded_protocol.OutputStyle outputStyle) throws IOException, SassCompilationFailedException
-
compileFile
public CompileSuccess compileFile(@NonNull @NonNull File inputFile) throws IOException, SassCompilationFailedException
-
compileFile
public CompileSuccess compileFile(@NonNull @NonNull File file, @NonNull @NonNull com.sass_lang.embedded_protocol.OutputStyle outputStyle) throws IOException, SassCompilationFailedException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getOutputStyle
public com.sass_lang.embedded_protocol.OutputStyle getOutputStyle()
How to format the CSS output.- See Also:
InboundMessage.CompileRequest.getStyle()
-
setOutputStyle
public void setOutputStyle(com.sass_lang.embedded_protocol.OutputStyle outputStyle)
How to format the CSS output.- See Also:
InboundMessage.CompileRequest.getStyle()
-
isGenerateSourceMaps
public boolean isGenerateSourceMaps()
Whether to generate a source map. Note that this will *not* add a source map comment to the stylesheet; that's up to the host or its users.- See Also:
InboundMessage.CompileRequest.getSourceMap()
-
setGenerateSourceMaps
public void setGenerateSourceMaps(boolean generateSourceMaps)
Whether to generate a source map. Note that this will *not* add a source map comment to the stylesheet; that's up to the host or its users.- See Also:
InboundMessage.CompileRequest.getSourceMap()
-
isAlertColor
public boolean isAlertColor()
Whether to use terminal colors in the formatted message of errors and logs.- See Also:
InboundMessage.CompileRequest.getAlertColor()
-
setAlertColor
public void setAlertColor(boolean alertColor)
Whether to use terminal colors in the formatted message of errors and logs.- See Also:
InboundMessage.CompileRequest.getAlertColor()
-
isAlertAscii
public boolean isAlertAscii()
Whether to encode the formatted message of errors and logs in ASCII.- See Also:
InboundMessage.CompileRequest.getAlertAscii()
-
setAlertAscii
public void setAlertAscii(boolean alertAscii)
Whether to encode the formatted message of errors and logs in ASCII.- See Also:
InboundMessage.CompileRequest.getAlertAscii()
-
isVerbose
public boolean isVerbose()
Whether to report all deprecation warnings or only the first few ones. If this is `false`, the compiler may choose not to send events for repeated deprecation warnings. If this is `true`, the compiler must emit an event for every deprecation warning it encounters.- See Also:
InboundMessage.CompileRequest.getVerbose()
-
setVerbose
public void setVerbose(boolean verbose)
Whether to report all deprecation warnings or only the first few ones. If this is `false`, the compiler may choose not to send events for repeated deprecation warnings. If this is `true`, the compiler must emit an event for every deprecation warning it encounters.- See Also:
InboundMessage.CompileRequest.getVerbose()
-
isQuietDeps
public boolean isQuietDeps()
Whether to omit events for deprecation warnings coming from dependencies (files loaded from a different importer than the input).- See Also:
InboundMessage.CompileRequest.getQuietDeps()
-
setQuietDeps
public void setQuietDeps(boolean quietDeps)
Whether to omit events for deprecation warnings coming from dependencies (files loaded from a different importer than the input).- See Also:
InboundMessage.CompileRequest.getQuietDeps()
-
isSourceMapIncludeSources
public boolean isSourceMapIncludeSources()
Whether to include sources in the generated sourcemap- See Also:
InboundMessage.CompileRequest.getSourceMapIncludeSources()
-
setSourceMapIncludeSources
public void setSourceMapIncludeSources(boolean sourceMapIncludeSources)
Whether to include sources in the generated sourcemap- See Also:
InboundMessage.CompileRequest.getSourceMapIncludeSources()
-
isEmitCharset
public boolean isEmitCharset()
Whether to emit a `@charset`/BOM for non-ASCII stylesheets.- See Also:
InboundMessage.CompileRequest.getCharset()
-
setEmitCharset
public void setEmitCharset(boolean emitCharset)
Whether to emit a `@charset`/BOM for non-ASCII stylesheets.- See Also:
InboundMessage.CompileRequest.getCharset()
-
isSilent
public boolean isSilent()
Whether to silently suppresses all`LogEvent`s
.- See Also:
InboundMessage.CompileRequest.getSilent()
-
setSilent
public void setSilent(boolean silent)
Whether to silently suppresses all`LogEvent`s
.- See Also:
InboundMessage.CompileRequest.getSilent()
-
setLoggingHandler
public void setLoggingHandler(LoggingHandler loggingHandler)
-
getLoggingHandler
public LoggingHandler getLoggingHandler()
-
-