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.
Example of light module structure:
magnolia.resources.dir/ └── foo/ ├── apps ├── blocks ├── contentTypes ├── decorations ├── dialogs │ ├── components │ └── pages ├── i18n │ └── foo-messages_en.properties ├── includes │ └── README.txt ├── messageViews ├── README.md ├── restEndpoints ├── templates │ ├── components │ └── pages ├── themes ├── virtualUriMappings └── webresources
(This example structure was created using version 3.1.0 of Magnolia CLI
comprehensive as the value of the
-P flag of the
create-light-module CLI command.)
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 its default value is
$magnolia.home/modules. To see the current value of the property, go
to the Config Info tab in the
About Magnolia app.
|You can use symbolic links (symlinks or soft links) in the resources directory to include light modules located elsewhere on your system.|
property to exclude directories from being observed for changes. (See
A change in the light modules folder may also flush the server cache.
You can configure this behavior under
pattern property, which specifies the pattern for the
operation. The default value is
Other non YAML-based items which can be in a light module:
Using the Magnolia CLI you can create the folder
structure for a light module with the command
Open a shell,
cd to your light modules directory, and execute the
mgnl create-light-module one-pager-module
When creating a name for a module, do not use spaces, accented
characters such as
ü or special characters
\ and so on). The name must match the regular
|This only works if you have installed Magnolia CLI, see Magnolia CLI Installation.|