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

时间:2011-12-20 02:42:53

标签: ruby rake

根据这个问题:Setting up rake-pipeline for use with handlebars alongside Google App Engine

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

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

1 个答案:

答案 0 :(得分:2)

简答:使用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