magefan/module-rocketjavascript

Question about bundling list

Closed this issue · 3 comments

Hi,

Thanks a lot for this module, so far it works great for us!

I've one question about the 'Include in bundling' list. How are we supposed to use this script? What's the PATH_TO_JS in a Magento 2 instance?

globalSrc = '';
jQuery('script').each(function(){
if (!jQuery(this).attr('src')) return;
var src = jQuery(this).attr('src');
if (src.indexOf('https://' + window.location.hostname) != -1 || src.indexOf('http://' + window.location.hostname) != -1) {
var src = (src.replace(PATH_TO_JS, ''));
globalSrc += "\n" + src;
}
})
console.log(globalSrc);

Thanks again.

Hello @Tjitse-E , thank you for your message regarding our Magento Rocket JavaScript / Deferred JavaScript Extension.

PATH_TO_JS - you need to replace it with a string of static content URL including language. E.g.
'https://domain.com/pub/static/version1549034518/frontend/Magento/luma/en_US/'

We have also updated read me file 8dc99a4

Please let us know if it help.

@magefan thanks, this is working for me!

So the idea here is to find out -by using your script- which non default JS resources the Magento 2 store is using, and then add these to the 'include in bundling' configuration?

@Tjitse-E , exactly. We have some predefined scripts in 'include in bundling' but as you may have a custom theme or extension we have created this simple script to help.