public class SassResourceHandler extends AbstractCompiledResourceHandler
Modifier and Type | Class and Description |
---|---|
private class |
SassResourceHandler.AmetysSassImporter
Sass Importer which can resolve Ametys resources
|
Modifier and Type | Field and Description |
---|---|
private static Pattern |
__IMPORT_PATTERN |
private static String[] |
__SASS_EXTENSION |
private io.bit3.jsass.Compiler |
_jsassCompiler |
private List<SassFunctionsProvider> |
_sassFunctionsProviders |
_cocoonContext, _context, _resolver, _supportedSuffixes
MAX_PRIORITY, MIN_PRIORITY
Constructor and Description |
---|
SassResourceHandler() |
Modifier and Type | Method and Description |
---|---|
protected Source |
_getImportSource(String currentUri)
Get the Sass source from the current Uri
|
String |
compileResource(Source resource)
Compile the current resource, and returns its value.
|
protected Source |
getCompiledSource(String location)
Get the compiled source uri
|
protected List<String> |
getDependenciesList(Source inputSource)
Calculate the list of dependencies for the given source, for validity calculations.
|
String |
getMimeType(Source source,
Parameters par)
Return the mime type of the configured resource.
|
int |
getPriority()
Get the priority of this handler
|
boolean |
isSupported(String source)
Determines if the resource is supported by this handler
|
void |
service(ServiceManager serviceManager) |
Source |
setup(String location,
Parameters par)
Initialize the resource handler with a resource.
|
generateResource, getKey, getValidity
configure, contextualize, getLastModified, getSize
getLogger, setLogger
private static final Pattern __IMPORT_PATTERN
private static final String[] __SASS_EXTENSION
private io.bit3.jsass.Compiler _jsassCompiler
private List<SassFunctionsProvider> _sassFunctionsProviders
public SassResourceHandler()
public void service(ServiceManager serviceManager) throws ServiceException
service
in interface Serviceable
service
in class AbstractResourceHandler
ServiceException
public int getPriority()
ResourceHandler
getPriority
in interface ResourceHandler
getPriority
in class AbstractResourceHandler
public boolean isSupported(String source)
ResourceHandler
isSupported
in interface ResourceHandler
isSupported
in class AbstractCompiledResourceHandler
source
- The uri of resourcetrue
if the resource is supportedprotected Source getCompiledSource(String location) throws MalformedURLException, IOException
AbstractCompiledResourceHandler
getCompiledSource
in class AbstractCompiledResourceHandler
location
- The requested locationMalformedURLException
- if location is malformed.IOException
- If an IO error occurspublic Source setup(String location, Parameters par) throws ProcessingException, IOException
ResourceHandler
setup
in interface ResourceHandler
setup
in class AbstractCompiledResourceHandler
location
- The source uripar
- The parametersProcessingException
- If an error occursIOException
- If an error occurspublic String compileResource(Source resource) throws IOException, ProcessingException
AbstractCompiledResourceHandler
compileResource
in class AbstractCompiledResourceHandler
resource
- The current resourceIOException
- If an IO error occursProcessingException
- If a processing error occursprotected List<String> getDependenciesList(Source inputSource)
AbstractCompiledResourceHandler
getDependenciesList
in class AbstractCompiledResourceHandler
inputSource
- The sourcepublic String getMimeType(Source source, Parameters par)
ResourceHandler
getMimeType
in interface ResourceHandler
getMimeType
in class AbstractResourceHandler
source
- The sourcepar
- The parametersprotected Source _getImportSource(String currentUri) throws URISyntaxException, IOException
currentUri
- The URIURISyntaxException
- If the Uri does not match a sourceIOException
- If an error occurred