WPIntell

Source evidence

Problem with calling function from enqueued script.

AssetsMinify · support · 2013-12-12T14:20:00+00:00

mixedsentiment
mediumseverity
0.78relevance
5replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

1 / 30 rows with source links

3.3% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

29 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
szaqal21 resolved
Plugin has hardcoded “async” attribute for script tag in function footerServe() and when I want to call a function from minified asset (right after minified asset script tag) <script async="" src="https://xyz/wp-content/uploads/am_assets/foot-63d925416ac7d2177826e375e86529d2.js" type="text/javascript"> <script type="text/javascript"> functionCall(); </script> I get an error about that the function is undefined. When I’ve removed async attribute from script tag every thing worked fine. Please add some option or a filter to give possibility to modify this behaviour. http://wordpress.org/plugins/assetsminify/ I’ll consider this for the next release of the plugin. Btw it is not a best practice to embed js within HTML code. Bye. I know but I don’t think it is necessary to create a seperate JS file just to call some init functions like Shadowbox.init() that’s why I’m embedding this in HTML code and several others init’s. You are right: it is not necessary. It is a best practice 😉 But isn’t including js code as separate files slower than including it in HTML (in cases like I mentioned above)? Could you give me some hints where to read more about it? I’ve read that it is better to limit the number of external files. Thanks Hi, new version released v1.2.2. Now you can enable async from backend. Btw, yes if you include multiple js files it is slower than including in HTML, but the best solution to achieve good performance and clean code is to compress the scripts with 1 single file and not to embed js script directly in the HTML files. Yes, it is better to limit the number of external files using js compression and minification. AssetsMinify does all of this. If you like, please review my plugin. Bye.

Comments

5 shown
Alessandro Carbone 2013-12-15T21:04:00+00:00

I’ll consider this for the next release of the plugin. Btw it is not a best practice to embed js within HTML code. Bye.

szaqal21 2013-12-16T10:34:00+00:00

I know but I don’t think it is necessary to create a seperate JS file just to call some init functions like Shadowbox.init() that’s why I’m embedding this in HTML code and several others init’s.

Alessandro Carbone 2013-12-16T10:38:00+00:00

You are right: it is not necessary. It is a best practice 😉

szaqal21 2013-12-17T08:23:00+00:00

But isn’t including js code as separate files slower than including it in HTML (in cases like I mentioned above)? Could you give me some hints where to read more about it? I’ve read that it is better to limit the number of external files. Thanks

Alessandro Carbone 2014-01-05T20:01:00+00:00

Hi, new version released v1.2.2. Now you can enable async from backend. Btw, yes if you include multiple js files it is slower than including in HTML, but the best solution to achieve good performance and clean code is to compress the scripts with 1 single file and not to embed js script directly in the HTML files. Yes, it is better to limit the number of external files using js compression and minification. AssetsMinify does all of this. If you like, please review my plugin. Bye.