magento / community-features

Magento Features Development is an Initiative to Allows Community Memebers Join to Development of Magento Features
46 stars 18 forks source link

ifconfig on <css> and <script> resources #293

Open mackieee opened 3 years ago

mackieee commented 3 years ago

I've built a module which is a store front specific development on a Multi-store setup. Thus only one store will require the need for the 3-4 <css /> & <script /> resources defined in the Module's Page Configuration files.

However this module is disabled on the other two sites with help of the adminhtml/system.xml, these are disabled by a custom is_enabled configuration.

Thus, some compoments are loaded at the Layout compiler, by the use of ifconfig. Others at the Block code.

However sadly, these other module-inactive store fronts - still load these frontend styles & js files, unnecessarily. Perhaps the performance may be negligible - but these resoruces are completely redundant.

I do believe allowing Developers to make modules more store-specific, gracefully makes store fronts cleaner and thus faster.

<head>
    <css src="Vendor_Example::styles.css" ifconfig="vendorexample/is_enabled" />
    <script src="Vendor_Example::example.js" ifconfig="vendorexample/is_enabled" />
</head>
m2-assistant[bot] commented 3 years ago

Hi @MackieeE. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this