我有一个网站需要很长时间才能加载其字体工具包样式,以及一些其他运行有趣的脚本。发生这种情况是因为我的脚本都在我的部分混乱,但我担心我对这些脚本的了解不够,无法正确清理我的文件。任何人都可以尝试建议我可以做一些事情来清理它并提高我的网站的速度和功能,特别是在更快地加载字体文本的情况下?任何示例或具体的参考资料都会很棒——我完全不知道这些脚本到底发生了什么。这是我发生的事情:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=0.3">
<meta name="google-translate-customization" content="d378d0a5e57245bf-c2ed76fd752675aa-g7014305900f205ae-13"></meta>
<title>{embed:title}</title>
<style type="text/css" media="screen">
@import url("/common/css/all.css");
@import url("/common/font_face/stylesheet.css");
@import url("/common/css/jcf.css");
</style>
<script type="text/javascript" src="/common/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="/common/js/jquery.main.js"></script>
<!--fancybox script starts here-->
<script type="text/javascript" src="/common/js/fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>
<script type="text/javascript" src="/common/js/fancybox/source/jquery.fancybox.js?v=2.0.6"></script>
<link rel="stylesheet" type="text/css" href="/common/js/fancybox/source/jquery.fancybox.css?v=2.0.6" media="screen" />
<link rel="stylesheet" href="/common/js/fancybox/source/helpers/jquery.fancybox-buttons.css?v=1.0.2" type="text/css" media="screen" />
<script type="text/javascript" src="/common/js/fancybox/source/helpers/jquery.fancybox-buttons.js?v=1.0.2"></script>
<script type="text/javascript" src="/common/js/fancybox/source/helpers/jquery.fancybox-media.js?v=1.0.0"></script>
<link rel="stylesheet" href="/common/js/fancybox/source/helpers/jquery.fancybox-thumbs.css?v=2.0.6" type="text/css" media="screen" />
<script type="text/javascript" src="/common/js/fancybox/source/helpers/jquery.fancybox-thumbs.js?v=2.0.6"></script>
<script type="text/javascript">
$(document).ready(function() {
// fancybox for html pages
$(".fancylink").fancybox({
'height' : '100%',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
});
$(".fancylinksm").fancybox({
'height' : 'auto',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
});
// fancybox for vimeo
$(".vimeo").fancybox({
width: 781,
height: 440,
type: 'iframe',
fitToView : false,
wrapCSS : 'fancybox-nav-video'
});
$('.fancybox').fancybox({
padding : 0,
openEffect : 'elastic'
});
$(".fancybox").fancybox({
wrapCSS : 'fancybox-custom',
closeClick : true,
helpers : {
overlay : {
css : {
'background-color' : '#000'
}
},
thumbs : {
width : 50,
height : 50
}
}
});
});
$("a[href$='.jpg'],a[href$='.jpeg'],a[href$='.png'],a[href$='.gif']").attr('rel', 'gallery').fancybox();
</script>
<!--fancybox script ends here-->
<link rel="shortcut icon" href="/common/images/cut-and-paste-logo.ico" type="image/x-icon" />
</head>
更新的代码 我将所有脚本编译成一个'compiled.js'文件并将所有@import 调用更改为s,但是它仍然没有使我的字体加载速度更快。这是新的部分:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=0.3">
<meta name="google-translate-customization" content="d378d0a5e57245bf-c2ed76fd752675aa-g7014305900f205ae-13"></meta>
<!-- meta data goes here -->
<title>{embed:title}</title>
<link rel='stylesheet' type='text/css' href='/common/font_face/stylesheet.css'>
<link rel='stylesheet' type='text/css' href='/common/css/all.css'>
<link rel='stylesheet' type='text/css' href='/common/css/jcf.css'>
<link rel="stylesheet" type="text/css" href="/common/css/jquery.fancybox.css?v=2.0.6" media="screen" />
<link rel="stylesheet" href="/common/css/jquery.fancybox-buttons.css?v=1.0.2" type="text/css" media="screen" />
<link rel="stylesheet" href="/common/css/jquery.fancybox-thumbs.css?v=2.0.6" type="text/css" media="screen" />
<link rel="shortcut icon" href="/common/images/characterized_logo_16x16.ico" type="image/x-icon" />
<!--[if lt IE 9]><link rel="stylesheet" type="text/css" href="css/ie.css" media="screen"/><![endif]-->
<script type="text/javascript" src="/common/js/compiled.js"></script>
</head>