magento / magento/community-features

ifconfig on <css> and <script> resources

Open
#293 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Priority: P4
Dominant language
No language data
Stars
46
Forks
14
PR merge metrics
No merged PRs in 30d

Description

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>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with the layout compiler and the Page Configuration XML entries shown in the issue; trace how ifconfig is handled for existing layout resources. Review the adminhtml/system.xml is_enabled setting and the related Block-side checks. Done means CSS and JavaScript resources are omitted on storefronts where the module is disabled, for both resource types.

Written by the indexing model from the issue text.

Assessment

Tech stack
xml
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.