CSS Configuration
In MageObsidian Components, including custom CSS from modules is straightforward and efficient. The system automatically tracks the following entry point in compatible modules:
This file will be included for each module that defines it, unless explicitly excluded by the theme configuration (more details on this functionality will be covered later).
How It Works
-
Import Order
CSS files are loaded based on the module priority defined in Magento. The order is determined by thesequence
configuration in each module’smodule.xml
file. This allows you to control the import order of module CSS. Additionally, all module CSS is loaded before theme CSS.For more details on configuring the module load order, see the official Magento documentation:
Configuring Component Load Order.A typical import order might look like this:
- Modules: If a module wants to include custom CSS, it should use the file located at
view/frontend/web/css/module.extend.css
as its entry point. MageObsidian Components automatically tracks these files for compatible modules. - Themes: The CSS entry point for themes is always
theme.source.css
.
- Modules: If a module wants to include custom CSS, it should use the file located at
-
Flexibility with Theme Configuration
As mentioned earlier, the theme configuration allows you to exclude CSS entries from specific modules. This provides flexibility in determining which styles are included in the final build.
Optimized CSS Output
MageObsidian Components leverages Tailwind CSS and tree-shaking techniques to generate a single, optimized CSS file. This final file includes only the styles required for the frontend, ensuring minimal size and maximum performance.
Key Benefits
- Modularity: CSS from modules is automatically integrated without additional effort.
- Control: Adjust the import order using the
sequence
configuration inmodule.xml
, or selectively include/exclude module CSS via theme settings. - Performance: The final optimized CSS file improves load times and reduces unnecessary styles.