Skip to content

Instantly share code, notes, and snippets.

@aboisvert
Created September 27, 2011 17:54
Show Gist options
  • Save aboisvert/1245748 to your computer and use it in GitHub Desktop.
Save aboisvert/1245748 to your computer and use it in GitHub Desktop.
Monkey patching Buildr's Mapper class to avoid resource filtering of binary file s
module Buildr
class Filter
class Mapper
alias_method :transform_old, :transform
BINARY_FILES = [ '*.png', '*.gif' ]
def is_binary?(content, path)
BINARY_FILES.any? { |glob| File.fnmatch(glob, path) }
end
def transform(content, path = nil)
return content if is_binary?(content, path)
transform_old(content, path)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment