【问题标题】:installing Closure Compiler on debian Nginx在 debian Nginx 上安装 Closure Compiler
【发布时间】:2014-06-04 05:33:58
【问题描述】:

我在互联网上搜索了一个关于如何在我的 Debian Nginx 服务器上从 google 安装 Closure Compiler 的好文档,但一无所获。到目前为止我得到的只是Closure Compiler。我想安装这个工具来独立压缩和缩小 css 和 js 文件,以便这些静态文件在请求时在页面加载时变得更轻。

有什么好的资源可以做到这一点吗?

我发现的只是 Yui 压缩器,它不如我读到的 Closure Compiler。

对此有什么想法吗?

【问题讨论】:

    标签: javascript nginx compression minify google-closure-compiler


    【解决方案1】:

    Closure Compiler 不会压缩 CSS 文件,只会压缩 JS 文件。你想要的:https://github.com/google/closure-stylesheets

    如果你想在不测试结果的情况下压缩任意 JS 文件,Closure Compiler 不是一个好的选择。面对 eval 或 IE 的条件代码时,它不会像其他一些压缩工具那样后退。

    如果您使用的是 Apache,您可能会喜欢 Google's PageSpeed module,它设计用于一般情况。

    【讨论】:

    • 有更好的选择吗?
    • 更好的选择是什么?
    • 压缩js文件甚至css文件。
    • 这真的取决于你想要做什么。仅从 JS 文件中删除空格可能会破坏某些库。但也许你想要:developers.google.com/speed/pagespeed/module
    • 使用 PageSpeed 链接更新答案
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-02-29
    • 1970-01-01
    • 2013-11-03
    • 2021-12-19
    • 2014-06-12
    • 2015-02-05
    • 2015-06-14
    相关资源
    最近更新 更多