Created
January 16, 2012 07:16
-
-
Save bobspryn/1619542 to your computer and use it in GitHub Desktop.
An import filter that take @imports in files inline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ImportFilter < Rake::Pipeline::Filter | |
def generate_output(inputs, output) | |
inputs.each do |input| | |
path = input.root + "/" + input.path.sub(/[^\/]+\.\w+/, "") | |
print "#{path}\n" | |
output.write input.read.gsub(/(@import\s+\"([^\"]+)\";)/) { | |
File.read("#{path}#{$2}") | |
} | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment