-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue 24666 (Static content is deploying for disabled modules) #25183
Conversation
Hi @Echron. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
…ubscriber unittest failing because of new lines in newsletter)
Just to have some status here, we looked at this issue during the contribution day of #mleu with @Echron and @okorshenko and it turns out that the solution is probably a lot deeper in that the agregated file list for css/less files isn't getting filtered based on if a module is enabled or disabled, and even if the module is not installed at all (Magento Commerce modules styling exist in the Blank theme, while the modules themselves are not available in Open Source and even then the generated css code contains styles from those Commerce modules). After some playing around, it looks like this might be a better fix: diff --git a/app/code/Magento/Developer/etc/di.xml b/app/code/Magento/Developer/etc/di.xml
index 98adcbb3a82..43082746c53 100644
--- a/app/code/Magento/Developer/etc/di.xml
+++ b/app/code/Magento/Developer/etc/di.xml
@@ -204,7 +204,7 @@
<arguments>
<argument name="libraryFiles" xsi:type="object">Magento\Framework\Css\PreProcessor\File\Collector\Library</argument>
<argument name="baseFiles" xsi:type="object">cssSourceBaseFilesSorted</argument>
- <argument name="overriddenBaseFiles" xsi:type="object">cssSourceOverriddenBaseFiles</argument>
+ <argument name="overriddenBaseFiles" xsi:type="object">cssSourceOverriddenBaseFilesSorted</argument>
</arguments>
</type>
@@ -224,6 +224,16 @@
</arguments>
</virtualType>
+ <virtualType name="cssSourceOverriddenBaseFilesSorted" type="Magento\Framework\View\File\Collector\Decorator\ModuleDependency">
+ <arguments>
+ <argument name="subject" xsi:type="object">cssSourceOverriddenBaseFilesFiltered</argument>
+ </arguments>
+ </virtualType>
+ <virtualType name="cssSourceOverriddenBaseFilesFiltered" type="Magento\Framework\View\File\Collector\Decorator\ModuleOutput">
+ <arguments>
+ <argument name="subject" xsi:type="object">cssSourceOverriddenBaseFiles</argument>
+ </arguments>
+ </virtualType>
<virtualType name="cssSourceOverriddenBaseFiles" type="Magento\Framework\View\File\Collector\Override\Base">
<arguments>
<argument name="subDir" xsi:type="string">web</argument> This shaves off about ~60KB of generated css on a vanilla Magento Open Source installation. |
@
For sure it will be more "understandable", but need to compare performance of these two options, looks like from performance perspective changes from this PR is better |
Hi @ihor-sviziev, according to the discussion with @okorshenko at #mleu, the preferred solution was to use decorators as a solution as that's fixing the root problem. Out of curiosity: how significant are the performance differences? |
(Drive by comment, sorry!) Can't remember if the JS/Grunt setup piggybacks on the PHP code's logic for collecting files. If not, we might need to fix that problem on the JS side too, to prevent making this problem worse |
Good point @DrewML But it looks like we are safe. Running
|
Thanks for verifying @hostep! |
@ihor-sviziev: I'm still planning on implementing the alternative solution one day (if I find the time), since it was discussed to be a better solution. |
@magento run all tests |
@hostep sure, no problem |
hi guys any update on this PR |
Hi, |
lib/internal/Magento/Framework/Css/PreProcessor/File/Collector/Aggregated.php
Show resolved
Hide resolved
Hi can i keep continue this PR ? Seem quite long inactivity no response from @Echron |
@mrtuvn yes, please update PR |
Hi @Echron, thank you for your contribution! |
Make the output of css file dependent on the status (enabled/disabled) of a module
Description (*)
Fixed logic for css preprocessor to check if module is enabled before including its less / css resources to the generated static styles.
Fixed Issues (if relevant)
Improving unittest of PR #24772