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, validateAndOutputMinimizedFile
getLogger, setLogger
private static final Pattern IMPORT_PATTERN
private io.bit3.jsass.Compiler _jsassCompiler
private JSASSResourceURIExtensionPoint _jsassResourceURIExtensionPoint
public MinimizeCSSManager()
public void initialize() throws Exception
initialize
in interface Initializable
Exception
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
service
in class AbstractMinimizeManager
ServiceException
public 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)
AbstractMinimizeManager
getMinimizedContent
in class AbstractMinimizeManager
fileUri
- The urinestedParentFilesName
- The parents file name, can be an empty string if there are no parentsprotected String applyMediaToContent(String content, String media)
AbstractMinimizeManager
applyMediaToContent
in class AbstractMinimizeManager
content
- The contentmedia
- The mediaprivate io.bit3.jsass.Output _minimizeCss(String cssUri, String nestedParentFilesName, String originalContent, boolean generateSourceMap) throws ProcessingException
ProcessingException
private URI _computeMinimizedUri(String sourceMapUri) throws URISyntaxException
URISyntaxException
private String _resolveImportUrl(String content, String nestedParentFilesName) throws URISyntaxException
URISyntaxException
protected void addSourceMap(com.google.debugging.sourcemap.SourceMapGeneratorV3 sourceMapGenerator, int lineCount, String fileContent, String fileUri, String sourceMapUri)
AbstractMinimizeManager
addSourceMap
in class AbstractMinimizeManager
sourceMapGenerator
- 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)
AbstractMinimizeManager
isSourceMappingURLLine
in class AbstractMinimizeManager
line
- The lineprotected String getSourceMappingURL(String line)
AbstractMinimizeManager
getSourceMappingURL
in class AbstractMinimizeManager
line
- The lineprotected String removeSourceMappingURLLine(String content)
AbstractMinimizeManager
removeSourceMappingURLLine
in class AbstractMinimizeManager
content
- The contentprotected String formatSourceMappingURL(String sourceMapName)
AbstractMinimizeManager
formatSourceMappingURL
in class AbstractMinimizeManager
sourceMapName
- The map name