rmrevin / yii2-minify-view

Yii2 View component with minification css & js
MIT License
191 stars 67 forks source link

Fixing Render Blocking Javascript and CSS in the Above-the-fold content #62

Open asadkhalili opened 6 years ago

asadkhalili commented 6 years ago

Hi Thanks. I want to solve this problem by putting the following code:

<script type="text/javascript"> function downloadJSAtOnload() { var element = document.createElement("script"); element.src = "defer.js"; document.body.appendChild(element); } if (window.addEventListener) window.addEventListener("load", downloadJSAtOnload, false); else if (window.attachEvent) window.attachEvent("onload", downloadJSAtOnload); else window.onload = downloadJSAtOnload; </script>

How do I get the name of the compressed Js file and put this code in page?

kwazaro commented 5 years ago

Same problem. Is there any possibility to add smth like cssPosition property or additional parameters to tag (like "prefetch" or "preload")? Or render minified CSS code directly inside tag? For Google Pagespeed purposes