Reputation: 984
Consider the following folder full of javascripts I want to compile into a single one using rake-pipeline
:
library-1
and library-2
depend on jQuery.
require "rake-pipeline-web-filters"
output "dist"
input "js" do
match "**/*.coffee" do
filter Rake::Pipeline::Web::Filters::CoffeeScriptFilter
end
match "**/*.js" do
filter Rake::Pipeline::Web::Filters::UglifyFilter
filter Rake::Pipeline::OrderingConcatFilter, ["jquery.js", "libs/ufvalidator.js"], "application.js"
end
end
I have noticed that when concatenating everything, the scripts written in Coffeescript are at the top. Won't OrderingConcatFilter
prevent this from happening? What should I fix so that the Coffeescript source is after jQuery?
Thank you.
Upvotes: 1
Views: 397
Reputation: 353
The UglifyFilter renames the files it processes to add a .min.js
suffix. jquery.js
goes into uglify, jquery.min.js
comes out.
I would probably put the UglifyFilter last, like this:
match "**/*.js" do
concat ["jquery.js", "libs/ufvalidator.js"], "application.js"
uglify
end
but you could also change the filenames you're matching with the ConcatFilter:
match "**/*.js" do
uglify
concat ["jquery.min.js", "libs/ufvalidator.min.js"], "application.js"
end
or tell the UglifyFilter not to rename the files:
match "**/*.js" do
uglify { |input| input }
concat ["jquery.js", "libs/ufvalidator.js"], "application.js"
end
Upvotes: 1