You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When should Magento_Baler be considered enabled for a given theme?
When Magento_Baler is an enabled module in the store
When the locale folder for the current theme contains a file called requirejs-baler-config.js
What Work Should Magento_Baler Do?
Loading of Core Bundle
On each request:
Replace requirejs-config.js in the head of the document with requirejs-baler-config.js
In the head of the document, add a preload tag that points to balerbundles/core-bundle.js in the root of the current theme's current locale
Loading of Dynamic Dependencies
On each request
Collect a list of file paths for all.phtml files being used to render the current request
Read/Parse baler-preload-map.json, which is a sibling of core-bundle.js in the root of the locale.
Create a new list, preloads
For each key in baler-preload-map.json:
Check if the .phtml file at that path was used to render
If yes, append the dependencies to preloads
De-duplicate the preloads list
For each entry in preloads, add a preload tag to the head of the document
Disabling Incompatible Features
The following features should be disabled when Magento_Baler is enabled:
JS Bundling
JS Minification
Stretch Goals
Make sure the list of .phtml files loaded keeps the order these were loaded on the page. When injecting preload tags in the head, inject them in the same order that the .phtml files were rendered (this effectively prioritizes content higher in the document)
The text was updated successfully, but these errors were encountered:
Here is a public repo with Magento_Baler module for inserting bundles configuration into the head of the document: https://github.com/adifucan/m2-baler
It's not 100% complete yet. Just for alpha testing.
baler
has 2 pieces that are necessary for bundling to work within Magento.baler
- annpm
package used to package bundles and generate configurationMagento_Baler
- a Magento module that injects necessary<link rel="preload" />
tags into thehead
of the documentRequirements
Magento_Baler
Artifacts made available by
baler
When
baler
is run, is spits out 2 different types of artifactscore-bundle.js
baler-preload-map.json
(see Generatebaler-preload-map.json
#3)When should Magento_Baler be considered enabled for a given theme?
Magento_Baler
is an enabled module in the storerequirejs-baler-config.js
What Work Should Magento_Baler Do?
Loading of Core Bundle
On each request:
requirejs-config.js
in thehead
of the document withrequirejs-baler-config.js
head
of the document, add apreload
tag that points tobalerbundles/core-bundle.js
in the root of the current theme's current localeLoading of Dynamic Dependencies
On each request
.phtml
files being used to render the current requestbaler-preload-map.json
, which is a sibling ofcore-bundle.js
in the root of the locale.preloads
baler-preload-map.json
:.phtml
file at that path was used to renderpreloads
preloads
listpreloads
, add apreload
tag to thehead
of the documentDisabling Incompatible Features
The following features should be disabled when
Magento_Baler
is enabled:Stretch Goals
.phtml
files loaded keeps the order these were loaded on the page. When injectingpreload
tags in thehead
, inject them in the same order that the.phtml
files were rendered (this effectively prioritizes content higher in the document)The text was updated successfully, but these errors were encountered: