asset aggregator
Contributes new or dynamically generated content to a fileset
. Content generated by
an aggregator might be processed by an
AssetProcessor.
how to use it?
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.