public final class WebBundleTool extends Object
Constructor and Description |
---|
WebBundleTool(File bundles)
Creates a new Resource Bundler saving the bundles in the specified location.
|
Modifier and Type | Method and Description |
---|---|
File |
bundle(List<File> files,
String name,
boolean minimize)
Bundles the specified files together, this method automatically detects the type.
|
File |
bundle(List<File> files,
String name,
BundleType type,
boolean minimize)
Bundles the specified files together.
|
File |
bundleScripts(List<File> files,
String name,
boolean minimize)
Bundles the specified files together.
|
File |
bundleStyles(List<File> files,
String name,
boolean minimize)
Bundles the specified files together.
|
protected static void |
concatenate(List<File> files,
File bundle,
boolean minimize)
Concatenate the contents of each file in the bundle.
|
protected static void |
expandStyles(WebBundle bundle,
Writer writer,
File virtual,
boolean minimize,
long threshold)
Concatenate the contents of each file in the bundle.
|
File |
getBundle(List<File> files,
String prefix,
boolean minimize)
Return the file bundling the specified list of files.
|
File |
getBundlesDir() |
protected static String |
getLocation(File source,
File target,
String path,
long threshold)
Recalculates the specified path from the original file (source) to the new file (target).
|
void |
setDataURIThreshold(long threshold)
Sets the threshold for data URI.
|
void |
setVirtual(File virtual)
Set the virtual location of the bundles.
|
public WebBundleTool(File bundles) throws IllegalArgumentException
bundles
- Where the bundles should be saved (must exist and be a directory).IllegalArgumentException
- If the specified file is null
, does not exist or is not a directory.public void setVirtual(File virtual)
virtual
- the virtual location of the bundles.public void setDataURIThreshold(long threshold)
threshold
- the threshold to setpublic File getBundlesDir()
public File getBundle(List<File> files, String prefix, boolean minimize)
files
- The list of files to bundle together.prefix
- The prefix for the bundle.minimize
- Whether to minimise the files.public File bundle(List<File> files, String name, boolean minimize) throws IOException
files
- The list of files to bundle together.name
- The name of the bundle.minimize
- Whether to minimise the files.IOException
- should an error occur while reading the files or writing the bundle.public File bundle(List<File> files, String name, BundleType type, boolean minimize) throws IOException
files
- The list of files to bundle together.name
- The name of the bundle.type
- The type of bundling.minimize
- Whether to minimise the files.IOException
- should an error occur while reading the files or writing the bundle.public File bundleScripts(List<File> files, String name, boolean minimize) throws IOException
files
- The list of files to bundle together.name
- The name of the bundle.minimize
- Whether to minimize the scripts.IOException
- should an error occur while reading the files or writing the bundle.public File bundleStyles(List<File> files, String name, boolean minimize) throws IOException
files
- The list of files to bundle together.name
- The name of the bundleminimize
- true
to minimize the javascript;
false
to simply concatenate.IOException
- should an error occur while reading the files or writing the bundle.protected static void concatenate(List<File> files, File bundle, boolean minimize) throws IOException
files
- The list of files to concatenate.bundle
- The bundle to write to.minimize
- true
to minimize the script;
false
otherwise.IOException
- if an input/output error occurs.protected static void expandStyles(WebBundle bundle, Writer writer, File virtual, boolean minimize, long threshold) throws IOException
bundle
- The list of files to concatenate.writer
- The bundle to write to.virtual
- The virtual location of the bundle.threshold
- The threshold for data URIsIOException
- if an input/output error occurs.protected static String getLocation(File source, File target, String path, long threshold)
source
- The source file.target
- The target file.path
- The location based on the source file.threshold
- the file size threshold for images not to be included using data URIsCopyright © 2016 Allette Systems. All rights reserved.