Package com.vaadin.base.devserver
Class PublicStyleSheetBundler
java.lang.Object
com.vaadin.base.devserver.PublicStyleSheetBundler
Utility that resolves and bundles public stylesheet resources referenced by
@StyleSheet URLs, in development time.
It locates the CSS entry file under common source roots that map to the
servlet context, and returns a single inlined CSS string with @import
rules resolved, using CssBundler.
The following source roots are searched under the current project folder:
- src/main/resources/META-INF/resources
- src/main/resources/resources
- src/main/resources/static
- src/main/resources/public
- src/main/webapp
-
Method Summary
Modifier and TypeMethodDescriptionBundles the CSS content for the given stylesheet URL by resolving it against known public source roots and inlining any@importstatements.static PublicStyleSheetBundlerforResourceLocations(List<File> roots) Creates a new bundler instance configured with an explicit list of source roots.static StringnormalizeUrl(String url) Normalize an incoming stylesheet URL from @StyleSheet into a relative path under the servlet context.
-
Method Details
-
forResourceLocations
Creates a new bundler instance configured with an explicit list of source roots. Only existing directories are included.- Parameters:
roots- list of root directories to search in- Returns:
- a configured
PublicStyleSheetBundler
-
bundle
Bundles the CSS content for the given stylesheet URL by resolving it against known public source roots and inlining any@importstatements.- Parameters:
url- the stylesheet URL as used in@StyleSheet; may start withcontext://or a leading '/'contextPath- the servlet context path- Returns:
- the bundled CSS content if the entry file was found and bundled;
otherwise,
Optional.empty()
-
normalizeUrl
Normalize an incoming stylesheet URL from @StyleSheet into a relative path under the servlet context.
-