public class CssPacker extends AbstractFilePacker
channel
Constructor and Description |
---|
CssPacker(java.lang.String packerDirectory)
Creates a new CSS packer.
|
Modifier and Type | Method and Description |
---|---|
static java.util.Set<java.lang.String> |
getCSSFilesInPack(java.util.Collection<java.lang.String> cssFiles,
java.lang.String browserName)
Returns the set of the URLs created with the CSS packer, respecting the constraints of the browser.
|
protected org.apache.log4j.Logger |
getLogger()
Returns the logger to be used for log messages.
|
static void |
minifyCSS(boolean force)
Create a minified version of all CSS found in JCMS.
|
protected boolean |
perFileMinificationEnabled()
Check if minification should be performed on each file as opposed to the whole pack.
|
protected java.lang.String |
processFileContent(java.lang.String cssRelativeFilePath,
java.io.File cssFile,
java.lang.String cssFileContent)
Process CSS files' content
|
protected java.lang.String |
processPackContent(java.lang.String packContent)
Process CSS pack's content
|
getFilePack, getFilesInPack, getMinifiedFile, minifyFile
public CssPacker(java.lang.String packerDirectory) throws java.lang.Exception
packerDirectory
- the relative path of the servlet/jsp that will be
outputing the packed css. MUST be specified.java.lang.IllegalArgumentException
- if packerDirectory is nulljava.lang.Exception
- on initialization errorprotected java.lang.String processFileContent(java.lang.String cssRelativeFilePath, java.io.File cssFile, java.lang.String cssFileContent)
processFileContent
in class AbstractFilePacker
cssRelativeFilePath
- the relative path of the file being processedcssFile
- the file being processedcssFileContent
- the fileContent as read by the AbstractFilePackerprotected java.lang.String processPackContent(java.lang.String packContent)
processPackContent
in class AbstractFilePacker
packContent
- the whole pack content as computed by the AbstractFilePackerprotected boolean perFileMinificationEnabled()
AbstractFilePacker
perFileMinificationEnabled
in class AbstractFilePacker
protected org.apache.log4j.Logger getLogger()
AbstractFilePacker
getLogger
in class AbstractFilePacker
Logger
of this packer, must not return null.public static void minifyCSS(boolean force)
This method only process css file if minification is enabled through property
"channel.css-packer.compressor.enabled"
.
Only files contained in directories css, plugins and js are processed
force
- set to true to force generation of minified file even if an up to date apparently existspublic static java.util.Set<java.lang.String> getCSSFilesInPack(java.util.Collection<java.lang.String> cssFiles, java.lang.String browserName)
cssFiles
- collection of CSS files to packbrowserName
- name of the browser used to find the properties 'channel.packer.xxx' defining the limit values. If null
, use 'IE'
because it's the most constraining.Copyright © 2001-2017 Jalios SA. All Rights Reserved.