TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask YC: Any risks with JS and CSS compression?

4 点作者 prashantdesale超过 16 年前
We are in final stages of finalizing our code for our open alpha. I am researching ways to improve the page load time and am looking at http://webjackalope.com/fast-page-load-time/<p>The article suggests to compress JS and CSS files, and I am feeling that we should compress our javascript files because we have lots them.<p>What worries me though is if something will break. Even if we try to test again, the application has lot of functions and testing would take time and at this moment I need to concentrate on hosting setup than application testing.<p>I've never done it, so want to understand the risks involved. Also if you can suggest best compression tools that would be great.<p>Thanks in advance,

5 条评论

qhoxie超过 16 年前
There aren't really any risks involved aside from the fact that most (all?) compressors expect well-formed scripts, and thus can break ones that don't meet standards.<p>A common way to do compression that will give you a similar effect is to gzip content from the web server.
评论 #286852 未加载
dhotson超过 16 年前
One thing that has bitten me a couple of times is that CSS compression can muck up your styles if you depend on the order of the CSS rules. Compression will sometime change the order of the rules.
nickb超过 16 年前
Minify JS, don't compress it. Same goes for CSS compression tools. They all have a potential to give you soooooooooo many headaches for very little gain. Instead, enable gzip compression.
ionfish超过 16 年前
Try PackR for your JavaScript (and then gzip it, obviously).<p><a href="http://github.com/jcoglan/packr/tree/master" rel="nofollow">http://github.com/jcoglan/packr/tree/master</a>
prashantdesale超过 16 年前
Thank you everyone for your feedback.