Light modules can be built with a simple text editor, with no special tools (such as Maven) required. A light module cannot incorporate java classes.
Light module structure
Example of light module structure:
Light modules can contain more or fewer folders compared to this example.
Light modules folder:
Magnolia light modules must reside within the Magnolia resources directory; this directory is also often referred to as the Magnolia light modules folder. The name and the location of this directory are arbitrary, but you must provide the path to the folder via configuration.
magnolia.resources.dir is a property defining the directory from which resources are loaded in a Magnolia instance. This directory is used for file-based resources such as light modules and for overriding classpath resources. The property is configured in
WEB-INF/config/default/magnolia.properties and has the default value
$magnolia.home. To see the current value of the property, see the list of properties in the About Magnolia app Config Info tab.
What items can be defined in a light module?
The following items can be defined within a light module using YAML. Items defined by YAML can be decorated.
- App definitions
- Dialog definitions
- Field type definitions
- Media editor definitions
- Message view definitions
- Renderer definitions
- Template definitions
- Theme definitions
Other non YAML-based items which can be in a light module:
- i18n message bundles (see Internationalization and related pages)
Creating a light module with Magnolia CLI
Using the Magnolia CLI you can create the folder structure for a light module with the command
create-light-module. Open a shell,
cd to your light modules directory, and execute the following command:
üor special characters (e.g. slashes
\and so on). The name must match the regular expression
Note that this only works if you have installed Magnolia CLI, see Magnolia CLI Installation.