Why merging CSS generates 2 or more file, not a single file?
-
02-10-2020 - |
Question
when i enable
Merge CSS Files -> Yes
magento generates 3 css files , why it can't generate as a single css file
is there any way to achieve this?
La solution
This normally happens when specific CSS files get loaded for certain routes.
For instance if we look at catalog_product_view
<catalog_product_view translate="label">
...
<reference name="head">
...
<action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/></action>
...
</reference>
...
</catalog_product_view>
In this case a newly generated merged file is created especaily for pages with the catalog_product_view tag. If you want to prevent this you should load all CSS under default.
Using the Magento merge CSS is debateable. I would advice you looking into grunt or gulp and have them merge and minify everthing. This way you can ensure that there will always be a correct CSS file.
Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange