Closed jlgoolsbee closed 11 years ago
I had that problem using the 2.1
branch, as jQuery was being put at the end of the minified file.
The following change solves the issue:
diff --git a/Rakefile b/Rakefile
index 7a3eec8..9e2f3b3 100644
--- a/Rakefile
+++ b/Rakefile
@@ -67,12 +67,15 @@ Rake::Minify.new(:minify_and_combine) do
puts "BEGIN Minifying #{output_file}"
group(output_file) do
+ add("#{source_dir}/javascripts/group/jquery.min.js")
files.each do |filename|
- puts "Minifying- #{filename} into #{output_file}"
- if filename.include? '.min.js'
- add(filename, :minify => false)
- else
- add(filename)
+ if !filename.include? 'jquery.min.js'
+ puts "Minifying- #{filename} into #{output_file}"
+ if filename.include? '.min.js'
+ add(filename, :minify => false)
+ else
+ add(filename)
+ end
end
end
end
In my opinion this problem does not exist anymore in 2.1 because the jquery.js is loaded separately from googleapis.com now and no longer included in the minify and combine process. Beside that it seems to be possible to define the order of javascripts in the require-js.yml config file.
You may not be up to date. Now there is a way to set load order in the config yaml. And yes you're right @wetty we're using jquery from the Google CDN right now.
Brandon Mathis schrieb:
Now there is a way to set load order in the config yaml
Is this in require-js.yml, as i mentioned?
The new "minify_and_combine" rake task should always add jquery to the output file first; right now it appears to pull them in alphabetically – which works fine until you add a .js file that starts with something alphabetically before "jquery".