Add New Theme
The Widget Framework is
shipped with one default theme called default
. To add
a new theme:
-
Add a folder for your theme to every widget's
theme
folder. If your theme is calledmy-theme
then you would need to add a widget/src/main/webapp/static/theme/my-theme
folder to every widget. -
Add a corresponding theme folder to the Widget Framework 's core
theme
folder:widget-framework-core/src/main/webapp/static/theme/my-theme
, for example. -
Create a
base
subfolder in eachmy-theme
folder you have created. Thebase
folder should contain all the theme's common.css
and graphics files (incss
andgfx
subfolders). You can also create variant folders that have the same structure as thebase
folder but with different names. The variant folders can contain modified.css
and graphics files, making it possible for the theme to include variations for use in different sections of a publication. Variants are selected by setting atheme.variant
section parameter in publication sections. -
Add a property setting like this to
widget-framework-core/src/main/resources/com/escenic/framework/ApplicationResources.properties
:publication.theme.my-theme.title = My theme
-
Add a transformer specification like this to your publication's POM file:
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>static/theme/my-theme/base/css/theme.css</resource> </transformer>
The Maven Shade plug-in will then merge all the
theme.css
files in all the widgets into a singletheme.css
file. -
Compile and deploy your code.
To use your new theme you will need to set the theme section parameter in your publication's root section. For information on how to do this, see Changing Themes and Variants, in the Widget Framework User Guide.