How to eliminate render blocking in angular-cli site?
once started, ng build --prod
I can go into my index.html
file in the newly created dist folder and add an attribute async
to the associated script tags so they don't get blocked. it helps with website speed but site crashes sporadically. is there an option in angular-cli.json
that will add this for me during build better? i run my site with google test on my website and the only thing i left to fix is ββto remove JavaScript render blocking andcss in the above content
below is a more specific result I get from https://developers.google.com/speed/pagespeed/insights/
Eliminate JavaScript and CSS rendering blocking in the above content
Your page has 4 blocking script resources and 1 blocking CSS resources. This results in a delay in the rendering of your page. None of the above content on your page can be loaded without waiting for the following resources to load. Try to defer or load blocking resources asynchronously, or embed critical parts of those resources directly into the html . Remove rendering with JavaScript:
source to share
I am afraid this is not possible with the CLI. See https://github.com/angular/angular-cli/issues/3323 for a discussion on the topic.
source to share