最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin6浏览0评论

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 css in above-the-fold content

below is a the more specific result i get from /

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 html. Remove render-blocking JavaScript:

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 css in above-the-fold content

below is a the more specific result i get from https://developers.google./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 html. Remove render-blocking JavaScript:

Share Improve this question edited May 29, 2017 at 14:42 alessandrio 4,3702 gold badges31 silver badges41 bronze badges asked May 29, 2017 at 4:41 Always LearnAlways Learn 6726 silver badges14 bronze badges 1
  • 1 @arvil please provide the answer – Always Learn Commented May 29, 2017 at 17:30
Add a ment  | 

1 Answer 1

Reset to default 5

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

发布评论

评论列表(0)

  1. 暂无评论