This article describes how to build modules and add patterns and widgets. This is primarily of interest to developers and content designers.
A module must use a standard directory structure, depending on whether it contains patterns or a widget and its associated pattern file. A module must also contain a module.json file that provides the required metadata to Inkling, such as a module’s identifier and version number.
EchoInk Habitat projects have a standardized directory structure that includes a trunk directory. All module subdirectories and supporting files must be located in the trunk/assets/modules directory.
All modules must contain a module.json file that you create. For more information, see Create a module and module.json file.
A module can contain any number of patterns or widgets in the patterns and widgets subdirectories, respectively. However, note the following:
If the module contains one or more widgets, the module must include both
patternsandwidgetssubdirectories because each widget must have a corresponding widget pattern to display in the Pattern Picker.EchoInk recommends placing a single widget in a module to maintain independent versioning per widget.
- If the module contains only non-widget patterns, the module does not need a
widgetssubdirectory.
The table lists the required and optional subdirectories and supporting files for a module. Subdirectories and files are required unless marked optional. Note that [module_dir] indicates the directory path modules/[module_org_slug].[module_name].
| Path and Purpose |
|---|
Directory containing all modules in a given project. The |
Directory for all of a single module’s files. |
File that contains metadata about the module, including its version number. |
Directory containing the widgets included with the module. Optional if module contains only non-widget patterns. |
Directory containing a single widget. Optional. |
Directory containing the patterns included with the module. |
File containing a single pattern. Optional. |