public class ZussFilter extends Filter implements Locator
Filter
that automatically parses
ZUSS code and renders CSS. Also
supports minifying files, if the ".min.css" extension is used. See
CssUnifyMinifyFilter
.
This filter can track changes to the source files, updating the result file on-the-fly. This makes it easy to develop and debug a live site.
Note that this instances of this class can only guarantee atomic access to the rendered CSS file within the current VM.
Constructor and Description |
---|
ZussFilter(Context context,
Restlet next,
File targetDirectory,
long minimumTimeBetweenValidityChecks)
Constructor using
BuiltinResolver . |
ZussFilter(Context context,
Restlet next,
File targetDirectory,
long minimumTimeBetweenValidityChecks,
Resolver resolver)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected int |
beforeHandle(Request request,
Response response) |
long |
getMinimumTimeBetweenValidityChecks()
A value of -1 disables all validity checking.
|
Reader |
getResource(String name) |
Set<File> |
getSourceDirectories()
The directories where the sources are found.
|
void |
setMinimumTimeBetweenValidityChecks(long minimumTimeBetweenValidityChecks) |
String |
toString() |
void |
translate(File zussFile,
File cssFile,
boolean minify)
Translate ZUSS to CSS, only if the ZUSS source is newer.
|
afterHandle, doHandle, getNext, handle, hasNext, setNext, setNext, start, stop
createFinder, finalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setContext, setDescription, setFinderClass, setName, setOwner
public ZussFilter(Context context, Restlet next, File targetDirectory, long minimumTimeBetweenValidityChecks)
BuiltinResolver
.context
- The contextnext
- The next restlettargetDirectory
- The directory into which CSS results should be writtenminimumTimeBetweenValidityChecks
- See getMinimumTimeBetweenValidityChecks()
public ZussFilter(Context context, Restlet next, File targetDirectory, long minimumTimeBetweenValidityChecks, Resolver resolver)
context
- The contextnext
- The next restlettargetDirectory
- The directory into which CSS results should be writtenminimumTimeBetweenValidityChecks
- See getMinimumTimeBetweenValidityChecks()
resolver
- The ZUSS resolverpublic Set<File> getSourceDirectories()
The set is thread-safe.
public long getMinimumTimeBetweenValidityChecks()
setMinimumTimeBetweenValidityChecks(long)
public void setMinimumTimeBetweenValidityChecks(long minimumTimeBetweenValidityChecks)
minimumTimeBetweenValidityChecks
- The minimum time between validity checks in millisecondsgetMinimumTimeBetweenValidityChecks()
public void translate(File zussFile, File cssFile, boolean minify) throws IOException
zussFile
- The ZUSS source filecssFile
- The CSS target file (will be overwritten)minify
- Whether to minify the CSSIOException
- In case of a reading, writing or translation errorCSSMin
protected int beforeHandle(Request request, Response response)
beforeHandle
in class Filter
public Reader getResource(String name) throws IOException
getResource
in interface Locator
IOException
Copyright © 2009-2016 Three Crickets LLC.