Module Configuration
In MageObsidian Components, each compatible module can include additional configurations by creating a configuration file at:
This file follows the CJS (CommonJS) format for compatibility reasons and exports a configuration object that is read by MageObsidian Components.
How It Works
-
Configuration File Loading
Configuration files are loaded in the order defined by thesequence
configuration in each module'smodule.xml
file.For more details on how to define the sequence of modules, see the official Magento documentation:
Configuring Component Load Order. -
Example Configuration File
A basic example of amodule.config.cjs
file might look like this:Currently, the only supported configuration option is for Tailwind CSS, but future updates will expand this functionality to allow additional module-specific options.
-
Overriding Module Configurations
Module configurations can be overridden directly in themes by creating a corresponding configuration file. For example:- When this file exists, it completely replaces the original configuration provided by the module.
- The theme configuration is not treated as an extension or a merged version of the module's configuration; instead, it fully overrides the original settings.
Benefits and Future Potential
- Customizability: Module configurations can be tailored to fit the needs of specific projects or themes without altering the module code.
- Scalability: The configuration system is designed to support additional options beyond Tailwind in future versions, providing greater flexibility for module developers.
- Control: Themes have the ability to fully override module configurations, ensuring a clean separation of concerns and avoiding unwanted side effects.
Key Notes
- The file format is strictly CJS for compatibility across environments.
- Configurations are loaded in the sequence defined in
module.xml
. For detailed guidance, refer to the official Magento documentation. - Overriding configurations in themes fully replaces the module's original settings, without merging or extending them.