@Retention(value=RUNTIME) @Target(value=TYPE) @Inherited @Documented @Repeatable(value=CssImport.Container.class) public @interface CssImport
The CSS files should be located in the place as JS module files:
frontenddirectory in your root project folder in case of WAR project
META-INF/resources/frontenddirectory (inside a project resources folder) in case of JAR project (if you are using Maven this is
The annotation doesn't have any effect in the compatibility mode: use it only for Polymer 3 templates.
Depending on the attributes provided, the CSS content will be appended in different ways:
<custom-style> <style> CSS-CONTENT </style> </custom-style>
<custom-style> <style include="INCLUDE-VALUE"> CSS-CONTENT </style> </custom-style>
<dom-module id="ID-VALUE"> <template> <style include="INCLUDE-VALUE"> CSS-CONTENT </style> </template> </dom-module>
<dom-module id="RANDOM-ID" theme-for="THEME-FOR-VALUE"> <template> <style include="INCLUDE-VALUE"> CSS-CONTENT </style> </template> </dom-module>
It is guaranteed that dependencies will be loaded only once. The files loaded
will be in the same order as the annotations were on the class. However,
loading order is only guaranteed on a class level; Annotations from different
classes may appear in different order, grouped by the annotated class. Also,
files identified by
@CssImport will be loaded after
NOTE: Currently all frontend resources are bundled together into one big
bundle. This means, that CSS files loaded by one class will be present on a
view constructed by another class. For example, if there are two classes
RootRoute annotated with
@Route(""), and another class
RouteA annotated with
will be present on the root route as well.
|Modifier and Type||Required Element and Description|
Location of the file with the CSS content.
|Modifier and Type||Optional Element and Description|
The 'id' of the new 'dom-module' created.
The 'id' of a module to include in the generated 'custom-style'.
The tag name of the themable element that the generated 'dom-module' will target.
public abstract String value
public abstract String include
public abstract String id
public abstract String themeFor
Copyright © 2021. All rights reserved.