Questions tagged «yui-compressor»

13
合并并缩小多个CSS / JS文件
我正在尝试通过合并和压缩CSS和JS文件来优化网站性能。考虑到我所面临的实际情况,我的问题更多是关于如何实现这一(具体)步骤的(尽管在其他开发人员中也应该是典型的)。 我的页面引用了多个CSS和JS文件,如下所示: <!-- It's easier to work on smaller files during development. Hence, the multiple CSS and JS files. --> <link type="text/css" rel="stylesheet" href="/css/main.css" /> <link type="text/css" rel="stylesheet" href="/css/secondary-1.css" /> <link type="text/css" rel="stylesheet" href="/css/secondary-2.css" /> <script type="text/javascript" src="/scripts/js/main.js"></script> <script type="text/javascript" src="/scripts/js/adapter/adapter.js"></script> <script type="text/javascript" src="/scripts/js/adapter/title-adapter.js"></script> 对于生产版本,我想将3个CSS文件合并为一个,并使用例如YUI Compressor将其最小化。但是,然后,我需要更新所有需要这3个文件的页面,以引用新近缩小的CSS。这似乎容易出错(例如,您要在许多文件中删除并添加一些行)。还有其他风险较小的方法吗?JS文件也有同样的问题。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.