Always Learn
Always Learn

Reputation: 672

how to eliminate the render blocking in angular-cli site?

after running ng build --prod I can go into my index.html file in the newly created dist folder and add the async attribute to the bundled script tags to keep them from being blocking. this helps with website speed but sporadically crashes the site. is there an option in the angular-cli.json that would add this for me during the build in a better way? i ran my site through google's test my website and the only thing i have left to fix is Eliminate render-blocking JavaScript and in above-the-fold content

below is a the more specific result i get from https://developers.google.com/speed/pagespeed/insights/

Eliminate render-blocking JavaScript and CSS in above-the-fold content

Your page has 4 blocking script resources and 1 blocking CSS resources. This causes a delay in rendering your page. None of the above-the-fold content on your page could be rendered without waiting for the following resources to load. Try to defer or asynchronously load blocking resources, or inline the critical portions of those resources directly in the . Remove render-blocking JavaScript:

Upvotes: 9

Views: 7582

Answers (1)

tobi-or-not-tobi
tobi-or-not-tobi

Reputation: 1260

I'm afraid its not possible with the CLI as of now. See https://github.com/angular/angular-cli/issues/3323 for a discussion on the topic.

Upvotes: 5

Related Questions