public class AssetCompiler extends Object
Process static files by validate or modify them in some way.
AssetProcessor,
Assets| Constructor and Description |
|---|
AssetCompiler(ClassLoader loader,
com.typesafe.config.Config conf) |
AssetCompiler(com.typesafe.config.Config conf) |
| Modifier and Type | Method and Description |
|---|---|
List<AssetAggregator> |
aggregators() |
List<String> |
assets(String name)
Get all the assets for the provided file set.
|
Map<String,List<File>> |
build(String dist,
File dir)
Build assets using the given distribution and write output to the provided directory.
|
File |
buildOne(String filename,
File dir)
Apply the processor pipeline to the given asset.
|
Set<String> |
fileset() |
Set<String> |
patterns()
Iterate over fileset and common path pattern for them.
|
List<AssetProcessor> |
pipeline(String dist)
List all the
AssetProcessor for a distribution (a.k.a. |
List<String> |
scripts(String fileset)
Get all the javascript (or derived) for the provided fileset.
|
void |
setProgressBar(BiConsumer<Integer,Integer> progress)
Set a progress bar.
|
void |
stop() |
List<String> |
styles(String fileset)
Get all the css files (or derived) for the provided fileset.
|
String |
summary(Map<String,List<File>> result,
Path outDir,
String dist,
long duration,
String... extraInfo)
Print a summary of the given results.
|
String |
toString() |
public AssetCompiler(com.typesafe.config.Config conf)
throws Exception
Exceptionpublic AssetCompiler(ClassLoader loader, com.typesafe.config.Config conf) throws Exception
Exceptionpublic List<String> assets(String name)
assets {
fileset {
home: [home.css, home.js]
}
}
This method returns home.css and home.js for home file
set. If there is no fileset under that name then it returns an empty list.name - Fileset name.public Set<String> patterns()
{
assets {
fileset {
lib: [js/lib/jquery.js],
home: [css/style.css, js/home.js]
}
}
}
This method returns a set with /css/** and /js/** pattern.public List<String> scripts(String fileset)
{
assets {
fileset {
mypage: [mypage.js, mypage.css]
}
}
}
This method returns mypage.js for mypage fileset.
fileset - Fileset name.public List<String> styles(String fileset)
{
assets {
fileset {
mypage: [mypage.js, mypage.css]
}
}
}
This method returns mypage.js for mypage fileset.
fileset - Fileset name.public List<AssetProcessor> pipeline(String dist)
AssetProcessor for a distribution (a.k.a. environment).dist - Distribution's name.AssetProcessor.public List<AssetAggregator> aggregators()
AssetAggregator.public Map<String,List<File>> build(String dist, File dir) throws Exception
dist - Distribution's name (usually dev or dist).dir - Output directory.Exception - If something goes wrong.public File buildOne(String filename, File dir) throws Exception
build(String, File) but for a
single file or asset.filename - Asset to build.Exception - If something goes wrong.public String summary(Map<String,List<File>> result, Path outDir, String dist, long duration, String... extraInfo)
result - Compilation result.outDir - Output directory.dist - Distribution (dev or prod).duration - Execution time in millis.extraInfo - Additional information.public void stop()
public void setProgressBar(BiConsumer<Integer,Integer> progress)
progress - Progress bar.Copyright © 2018. All rights reserved.