Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
Index: trunk/vendor/plugins/asset_packager/lib/synthesis/asset_package.rb =================================================================== --- trunk/vendor/plugins/asset_packager/lib/synthesis/asset_package.rb (revision 67) +++ trunk/vendor/plugins/asset_packager/lib/synthesis/asset_package.rb (revision 69) @@ -4,5 +4,10 @@ @@asset_packages_yml = $asset_packages_yml || (File.exists?("#{RAILS_ROOT}/config/asset_packages.yml") ? YAML.load_file("#{RAILS_ROOT}/config/asset_packages.yml") : nil) - + + cattr_accessor :compress_js, :compress_css, :remove_css_comments + @@compress_js = true if @@compress_js.nil? + @@compress_css = true if @@compress_css.nil? + @@remove_css_comments = true if @@remove_css_comments.nil? + # singleton methods def self.find_by_type(asset_type) @@ -146,6 +151,8 @@ def compressed_file case @asset_type - when "javascripts" then compress_js(merged_file) - when "stylesheets" then compress_css(merged_file) + when "javascripts" + @@compress_js ? compress_js(merged_file) : merged_file + when "stylesheets" + @@compress_css ? compress_css(merged_file) : merged_file end end @@ -174,5 +181,5 @@ def compress_css(source) source.gsub!(/\s+/, " ") # collapse space - source.gsub!(/\/\*(.*?)\*\/ /, "") # remove comments - caution, might want to remove this if using css hacks + source.gsub!(/\/\*(.*?)\*\/ /, "") if @@remove_css_comments # remove comments - caution, might want to disable this with Synthesis::AssetPackage.remove_css_comments = false if using css hacks source.gsub!(/\} /, "}\n") # add line breaks source.gsub!(/\n$/, "") # remove last break
This paste will be private.
From the Design Piracy series on my blog: