Skip to content
Browse files

also minimize extcanvas js script

  • Loading branch information...
1 parent 66a7d4b commit bc83bcaec9773b4356ebec9770c8ec4e6bd0f095 Julien Kirch committed Mar 27, 2012
Showing with 12 additions and 3 deletions.
  1. +11 −2 process_assets.rb
  2. +1 −1 public/index.origin.html
View
13 process_assets.rb
@@ -100,9 +100,13 @@ def self.generate_static_content
CSS_TARGET_FILENAME = 'public/assets/complete.css'
CSS_TARGET_MIN_FILENAME = 'public/assets/complete-min.css'
+
JS_TARGET_FILENAME = 'public/assets/complete.js'
JS_TARGET_MIN_FILENAME = 'public/assets/complete-min.js'
+EXTCANVAS_SOURCE_FILENAME = 'public/external/excanvas.js'
+EXTCANVAS_TARGET_FILENAME = 'public/assets/excanvas-min.js'
+
def generate_minified_assets
p "Generate minified assets"
@@ -138,17 +142,22 @@ def generate_minified_assets
index_content = IO.read('public/index.origin.html')
index_content_debug = index_content.
gsub('<!-- js -->', js_files_list.collect { |js| "<script src=\"/#{js}\" type=\"text/javascript\"></script>" }.join("\n\t")).
- gsub('<!-- css -->', css_files_list.collect { |css| "<link href=\"#{css}\" rel=\"stylesheet\" type=\"text/css\"/>" }.join("\n\t"))
+ gsub('<!-- css -->', css_files_list.collect { |css| "<link href=\"#{css}\" rel=\"stylesheet\" type=\"text/css\"/>" }.join("\n\t")).
+ gsub('<!-- extcanvas -->', "<link href=\"external/extcanvas.js\" rel=\"stylesheet\" type=\"text/css\"/>")
write_to_file index_content_debug, 'public/index.debug.html'
index_content_prod = index_content.
gsub('<!-- js -->', "<script src=\"/assets/complete-min.js\" type=\"text/javascript\"></script>").
- gsub('<!-- css -->', "<link href=\"/assets/complete-min.css\" rel=\"stylesheet\" type=\"text/css\"/>")
+ gsub('<!-- css -->', "<link href=\"/assets/complete-min.css\" rel=\"stylesheet\" type=\"text/css\"/>").
+ gsub('<!-- extcanvas -->', "<link href=\"assets/extcanvas-min.js\" rel=\"stylesheet\" type=\"text/css\"/>")
File.open('public/index.html', 'w') { |f| f.write(index_content_prod) }
compressed = Uglifier.compile(File.read(JS_TARGET_FILENAME), {:copyright => false})
write_to_file compressed, JS_TARGET_MIN_FILENAME
+
+ compressed = Uglifier.compile(File.read(EXTCANVAS_SOURCE_FILENAME), {:copyright => false})
+ write_to_file compressed, EXTCANVAS_TARGET_FILENAME
end
%w(public/assets public/data).each do |d|
View
2 public/index.origin.html
@@ -13,7 +13,7 @@
<!-- js -->
<!--[if lt IE 9]>
- <script src="/external/excanvas.js" type="text/javascript"></script>
+ <!-- extcanvas -->
<![endif]-->
</head>

0 comments on commit bc83bca

Please sign in to comment.
Something went wrong with that request. Please try again.