public abstract class AssetAggregator extends AssetOptions
Contributes new or dynamically generated content to a fileset. Content generated by an aggregator might be processed by an AssetProcessor.
First thing to do is to add the dependency:
<dependency>
<groupId>org.jooby</groupId>
<artifactId>jooby-assets-dr-svg-sprites</artifactId>
<scope>provided</scope>
</dependency>
Did you see the provided scope? We just need the aggregator for development, because assets are processed at runtime. For prod, assets are processed at built-time via Maven/Gradle plugin, so we don't need it. This also, helps to keep our dependencies and the jar size small.
Now we have the dependency all we have to do is to add the svg-sprites aggregator to a fileset:
assets {
fileset {
home: [
// 1) Add the aggregator to a fileset
svg-sprites,
css/style.css,
js/app.js
]
}
svg-sprites {
// 2) The `css/sprite.css` file is part of the `home` fileset.
spritePath: "css/sprite.css"
spriteElementPath: "images/svg",
}
}
Here for example, the svg-sprites aggregator contributes the css/sprite.css file to the home fileset. The fileset then looks like:
assets {
fileset {
home: [
css/sprite.css,
css/style.css,
js/app.js
]
}
}
Replaces the aggregator name with one or more files from fileset() method.
| Constructor and Description |
|---|
AssetAggregator() |
| Modifier and Type | Method and Description |
|---|---|
abstract List<String> |
fileset() |
String |
name() |
abstract void |
run(com.typesafe.config.Config conf)
Run the aggregator and generates some output.
|
AssetAggregator |
set(com.typesafe.config.Config options) |
AssetAggregator |
set(String name, Object value) |
String |
toString() |
excludes, get, optionspublic String name()
public AssetAggregator set(String name, Object value)
set in class AssetOptions
public AssetAggregator set(com.typesafe.config.Config options)
set in class AssetOptions
public abstract List<String> fileset()
public abstract void run(com.typesafe.config.Config conf)
throws Exception
conf - Assets conf.
Exception - If something goes wrong.
Copyright © 2019. All rights reserved.