use of org.apache.wicket.markup.head.CssReferenceHeaderItem in project wicket by apache.
the class ResourceBundles method addCssBundle.
/**
* Adds a css bundle that is automatically generated by concatenating the given package
* resources. If the given resources depend on each other, you should make sure that the
* resources are provided in the order they need to be concatenated. If the resources depend on
* other resources, that are not part of the bundle, the bundle will inherit these dependencies.
*
* This method is equivalent to {@link #addBundle(HeaderItem)} with a {@link CssHeaderItem} for
* a {@link ConcatResourceBundleReference}.
*
* @param scope
* The {@linkplain ResourceReference#getScope() scope} of the bundle
* @param name
* The name of the resource. This will show up as the filename in the markup.
* @param references
* The resources this bundle will consist of.
* @return the newly created bundle
*/
public CssReferenceHeaderItem addCssBundle(Class<?> scope, String name, CssResourceReference... references) {
List<CssReferenceHeaderItem> items = new ArrayList<CssReferenceHeaderItem>();
for (CssResourceReference curReference : references) {
items.add(CssHeaderItem.forReference(curReference));
}
ConcatResourceBundleReference<CssReferenceHeaderItem> bundleReference = newBundleResourceReference(scope, name, items);
if (Application.exists()) {
ICssCompressor cssCompressor = Application.get().getResourceSettings().getCssCompressor();
bundleReference.setCompressor(cssCompressor);
}
return addBundle(CssHeaderItem.forReference(bundleReference));
}
Aggregations