Zend Framework CSS / JS minifier-obfuscator?
我正在开发一个有超过 10 个 CSS + JS 文件的项目。
我想缩小/压缩/混淆 CSS 和 JS。
一种方法是我可以手动执行此操作。
但是除了手动之外,Zend Framework 中是否有任何函数/方法可以实现这一目标?
提前致谢!
I am working on project which is having more than 10 CSS + JS files.
I want to minify/compress/obfuscate CSS and JS.
One approach is I can do this manually.
But apart from manual effort is there any function/method available in Zend Framework to achieve this goal?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
尝试 Minify 我已经在几个 ZF 项目中使用过它。只需将其安装在 /public_html/min 中,它就会动态缩小和压缩 css 和 javascript,并具有缓存功能。总体而言,性能非常好,并且脚本占用空间很小。
Try Minify I have used it in several ZF projects. Just install it in /public_html/min it will then minify and compress css and javascript on the fly and has a cache feature. On the whole the peformance is very good and the script has a small footprint.
我们编写了一个 shell 脚本,通过 YUI 压缩器 运行所有文件,然后将它们全部捆绑在一起。最初看起来可能很复杂,但事实并非如此。该脚本最终成为我们应用程序的单命令部署。
这个 shell 做了很多特定于我们的后端架构(git、Erlang...)的其他事情,所以我无法轻松提取这个特定部分。但雅虎的文档做得很好。
We wrote a shell script that runs all the files through YUI compressor and then bundle them all together. It may look complex initially but it's not. This script ended up being our one-command-deployment for our app.
This shell does plenty of other thing specific to our backend architecture(git, Erlang,...) so I can't extract this specific part easily. But Yahoo's doc is well done.
正如 Mic 所建议的,它对 YUI + Shell 命令非常好,我可以在 ZF 字段之外添加另一个建议
google pagespeed mod 有很多过滤器,可以轻松实现您的目标
http ://code.google.com/speed/page-speed/docs/filter-js-minify.html
http://code.google.com/speed/page-speed/docs/filter-css-rewrite.html
As Mic suggest ,its very good to YUI + Shell command and i can add another suggestion outside of ZF field
google pagespeed mod has many filter than can achieve your goals easily
http://code.google.com/speed/page-speed/docs/filter-js-minify.html
http://code.google.com/speed/page-speed/docs/filter-css-rewrite.html
还没有尝试过,但 bundle-phu 可能就是您正在寻找的。
Haven't tried it yet, but bundle-phu is probably what you are looking for.
麦克风建议很好,但对我来说,使用像 maven.apache.org 这样的管理/构建工具要容易得多(对于 php)来完成这些工作以及更需要的自动化(例如测试)。我正在使用自己编写的js混淆工具cactus,它也可以用作单独的控制台工具作为 Maven 插件。
Mic suggestion is nice, but for me it is much easier to use management/build tool like maven.apache.org (for php) to do this stuff and a much more required automation (for instance testing). And I'm using self written tool for js obfuscation cactus, which can be used as separate console tool as well as maven plugin.