public class MinimizeCSSManager extends AbstractMinimizeManager implements Component, Initializable
| Modifier and Type | Field and Description |
|---|---|
private io.bit3.jsass.Compiler |
_jsassCompiler |
private JSASSResourceURIExtensionPoint |
_jsassResourceURIExtensionPoint |
private static Pattern |
IMPORT_PATTERN |
static String |
ROLE
The avalon ROLE
|
_proxiedContextPathProvider, _resolver, _sourceMapCache| Constructor and Description |
|---|
MinimizeCSSManager() |
| Modifier and Type | Method and Description |
|---|---|
private URI |
_computeMinimizedUri(String sourceMapUri) |
private io.bit3.jsass.Output |
_minimizeCss(String cssUri,
String nestedParentFilesName,
String originalContent,
boolean generateSourceMap) |
private String |
_resolveImportUrl(String content,
String nestedParentFilesName) |
protected void |
addSourceMap(com.google.debugging.sourcemap.SourceMapGeneratorV3 sourceMapGenerator,
int lineCount,
String fileContent,
String fileUri,
String sourceMapUri)
Aggregate the source map of the single file with the others
|
protected String |
applyMediaToContent(String content,
String media)
Defaut implementation to apply a media to a content.
|
protected String |
formatSourceMappingURL(String sourceMapName)
Format a source mapping URL to be added at the end of a minimized file
|
protected String |
getMinimizedContent(String fileUri,
String nestedParentFilesName)
Get the minimized content at the specified URI
|
protected String |
getSourceMappingURL(String line)
Get the source mapping URL value from the line
|
void |
initialize() |
protected boolean |
isSourceMappingURLLine(String line)
Test if the line contains a source mapping URL
|
String |
minimizeCss(String code,
String location)
Minimize a CSS string
|
String |
minimizeCss(String code,
String location,
String sourceMapKey,
Long lastModified)
Minimize a CSS string
|
protected String |
removeSourceMappingURLLine(String content)
Remove the source mapping url from the content
|
void |
service(ServiceManager smanager) |
convertSourceMapURIs, minimizeAndAggregateURIs, validateAndOutputMinimizedFilegetLogger, setLoggerprivate static final Pattern IMPORT_PATTERN
private io.bit3.jsass.Compiler _jsassCompiler
private JSASSResourceURIExtensionPoint _jsassResourceURIExtensionPoint
public MinimizeCSSManager()
public void initialize() throws Exception
initialize in interface InitializableExceptionpublic void service(ServiceManager smanager) throws ServiceException
service in interface Serviceableservice in class AbstractMinimizeManagerServiceExceptionpublic String minimizeCss(String code, String location) throws ProcessingException, IOException
code - The CSS codelocation - The CSS location, can be null if no location was determinedProcessingException - If an error occurred during minimizationIOException - If an error occurred while retrieving the source mappublic String minimizeCss(String code, String location, String sourceMapKey, Long lastModified) throws IOException, ProcessingException
code - The CSS codelocation - The CSS location, can be null if no location was determined, in which case no source map will be generatedsourceMapKey - The key to store the source map in cache. Can be null to prevent source map generationlastModified - The last modified date of the code, used to assert validity of the source map cache. Can be nullProcessingException - If an error occurred during minimizationIOException - If an error occurred while retrieving the source mapprotected String getMinimizedContent(String fileUri, String nestedParentFilesName)
AbstractMinimizeManagergetMinimizedContent in class AbstractMinimizeManagerfileUri - The urinestedParentFilesName - The parents file name, can be an empty string if there are no parentsprotected String applyMediaToContent(String content, String media)
AbstractMinimizeManagerapplyMediaToContent in class AbstractMinimizeManagercontent - The contentmedia - The mediaprivate io.bit3.jsass.Output _minimizeCss(String cssUri, String nestedParentFilesName, String originalContent, boolean generateSourceMap) throws ProcessingException
ProcessingExceptionprivate URI _computeMinimizedUri(String sourceMapUri) throws URISyntaxException
URISyntaxExceptionprivate String _resolveImportUrl(String content, String nestedParentFilesName) throws URISyntaxException
URISyntaxExceptionprotected void addSourceMap(com.google.debugging.sourcemap.SourceMapGeneratorV3 sourceMapGenerator, int lineCount, String fileContent, String fileUri, String sourceMapUri)
AbstractMinimizeManageraddSourceMap in class AbstractMinimizeManagersourceMapGenerator - The aggregator helperlineCount - The current line countfileContent - The content of the filefileUri - The uri of the filesourceMapUri - The sourceMappingURL found at the end of the file contentprotected boolean isSourceMappingURLLine(String line)
AbstractMinimizeManagerisSourceMappingURLLine in class AbstractMinimizeManagerline - The lineprotected String getSourceMappingURL(String line)
AbstractMinimizeManagergetSourceMappingURL in class AbstractMinimizeManagerline - The lineprotected String removeSourceMappingURLLine(String content)
AbstractMinimizeManagerremoveSourceMappingURLLine in class AbstractMinimizeManagercontent - The contentprotected String formatSourceMappingURL(String sourceMapName)
AbstractMinimizeManagerformatSourceMappingURL in class AbstractMinimizeManagersourceMapName - The map name