删除阻止渲染的JavaScript [英] Remove render-blocking JavaScript

查看:39
本文介绍了删除阻止渲染的JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用angularjs开发网站.我必须加载大约42个javascript文件.Google PageSpeed Insight要求删除删除阻止渲染的JavaScript.

i am developing a web in angularjs. there are approx 42 javascript files which i have to load. Google PageSpeed Insight ask to remove Remove render-blocking JavaScript.

    <script async src="path to file"></script> 

它会加载asyn文件,但在需要jquery文件的文件之后会加载jquery.js文件.由于网站加载时间过长,我被卡住了.请帮忙.谢谢

it load files asyn but jquery.js file loading after files which need jquery file.i am stuck because site taking a lot of time to load.Please help.Thanks in advance

推荐答案

关于实现该目标的不同方法(使用模块和 https://github.com/systemjs/systemjs ),但TL; DR-尝试将jQuery脚本调用放在网页的首页标记中,而其他脚本放在html页面底部.

There can be long answer about different ways to implement that (using modules and http://requirejs.org/ or https://github.com/systemjs/systemjs), but TL;DR - try to put jQuery script call inside the head tag of your webpage, while the others scripts in bottom of html page.

这篇关于删除阻止渲染的JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆