我如何使用压缩器作为我的 rake-pipeline 资产工作流程的一部分

发布于 12-22 04:31 字数 363 浏览 2 评论 0原文

根据这个问题:设置 rake-pipeline 以与把手和 Google App Engine 一起使用

我一直在学习如何使用 rake-pipeline 来管理我的资产以供使用ember.js(在 dudleyf 的慷慨帮助下)。

我想知道的是如何将压缩器作为某种 rake-pipeline 过滤器合并到构建过程中。抱歉,我对 Ruby 不熟悉,所以我可能需要更深入的解释。

Per this question: Setting up rake-pipeline for use with handlebars alongside Google App Engine

I've been learning how to use rake-pipeline to manage my assets for use with ember.js (with the gracious help of dudleyf).

What I would like to know is how I might incorporate a minifier into the build process as some sort of rake-pipeline filter. Apologies as I'm not familiar with Ruby, so I might need a little more in depth explanation.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

缪败2024-12-29 04:31:17

简短的回答:使用 YUIJavaScriptCompressor。此 Assetfile

require "rake-pipeline-web-filters"
require "rake-pipeline-web-filters/helpers"

input "assets"
output "public"

match "**/*.js" do
  yui :munge => true
end

将获取 assets 目录中的每个 JavaScript 文件,并使用 munge 选项通过 YUI JavaScript 压缩器运行它。默认情况下,它将每个 *.js 文件重命名为 *.min.js

The short answer: use the YUIJavaScriptCompressor. This Assetfile:

require "rake-pipeline-web-filters"
require "rake-pipeline-web-filters/helpers"

input "assets"
output "public"

match "**/*.js" do
  yui :munge => true
end

will take each JavaScript file in your assets directory and run it through the YUI JavaScript compressor with the munge option. By default, it will rename each *.js file to *.min.js.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文