Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updating Rakefile to compress files in the proper order

  • Loading branch information...
commit 4553b0f2754205e332c1344ca51dcb48b7454989 1 parent 1114c60
Jeff Wallace authored
Showing with 23 additions and 6 deletions.
  1. +1 −0  .gitignore
  2. +22 −6 Rakefile
View
1  .gitignore
@@ -0,0 +1 @@
+ajax-solr.min.js
View
28 Rakefile
@@ -5,14 +5,30 @@ desc 'Compress all JavaScript files'
task :compress do
output_file = ENV.include?('output') ? ENV['output'] : 'ajax-solr.min.js'
+ core = [
+ 'Core',
+ 'AbstractManager',
+ 'ParameterStore',
+ 'AbstractWidget',
+ 'AbstractFacetWidget'
+ ]
+
+ dirs = [
+ 'core',
+ 'helpers',
+ 'managers',
+ 'widgets'
+ ]
+
File.open(output_file, 'w') do |output|
compressor = YUI::JavaScriptCompressor.new(:munge => true)
- files = Dir['**/*.js']
- files.each do |file|
- next if file == output_file
- puts "Compressing #{file}"
- input = ''
- File.open(file, 'r') { |f| input = f.read }
+
+ files = core.map{ |name| "core/#{name}.js" } + dirs.map{ |dir| Dir["#{dir}/**/*.js"] }.flatten
+ files.uniq!
+
+ files.each do |file_name|
+ puts "Compressing #{file_name}"
+ input = File.open(file_name, 'r') { |f| f.read }
output.write(compressor.compress(input))
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.