hakeryk2 Posted October 3, 2017 Share Posted October 3, 2017 (edited) Hi developers, Can anyone can tell me where I can find a code which is responsible for creating combined js file of all js files? I mean everytime in footer we can find file like v_235_a8347981273902.js which is combined js file with all of the files. I want to know where I can find function responsible for creating this code because I want to ad async parameter to this script <script> Anyone? This is even more funny because if I will put some js manually in code like in footer.tpl <script async="async" defer type="text/javascript" src="{if isset($force_ssl) && $force_ssl}{$base_dir_ssl}themes/default-bootstrap{else}{$base_dir}themes/default-bootstrap{/if}/fastjs.js?ver=1.42"></script> then in final code asyn="async" is deleted. I found out that responsible for this is function in back office "Move JavaScript to the end" because when it's set to NO then everything works but then JavaScript is not at the bottom of document so it's bad to me. I have checked minify_html.class.php, HTMLPurifier.standalone and Media.php and it looks like the answer to my question is there but I can't find any piece of code that will match my request. Edited October 4, 2017 by hakeryk2 (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted October 4, 2017 Share Posted October 4, 2017 async is only meant to be used for scripts loaded externally. you appear to be wanting to use it on scripts that will be served locally from your server, and that is not the intention of async Link to comment Share on other sites More sharing options...
Jezza Posted August 10, 2020 Share Posted August 10, 2020 I would be interested if you found a solution? Perhaps you used defer instead? Link to comment Share on other sites More sharing options...
hakeryk2 Posted August 10, 2020 Author Share Posted August 10, 2020 Nah, I leaved as it is but I started to load code when needed spliting huge js files into chunks and get them or some function with getScript when they were really needed. Link to comment Share on other sites More sharing options...
Jezza Posted August 11, 2020 Share Posted August 11, 2020 So I discovered all the JS files are referenced in templates/_partials/javascript.tpl in your theme. I simply added the defer attribute for all external scripts. Now, even with CCC turned on for JS, the defer attribute persists. Didnt think it would be so easy! This was all I wanted to keep gtmetrix.com happy Link to comment Share on other sites More sharing options...
El Patron Posted December 21, 2022 Share Posted December 21, 2022 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now