Created
December 29, 2009 19:57
-
-
Save NV/265546 to your computer and use it in GitHub Desktop.
Simple JS preprocessor with /*> file.js */
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
#!/usr/bin/env ruby | |
# FILE MOVED TO http://github.com/NV/js-preprocessor | |
# http://stackoverflow.com/questions/1975714/include-one-file-to-another | |
ARGV.each do |a| | |
f = File.read(a) | |
puts f.gsub!(%r{"/\*>\s*(.+?)\s*\*/"}) { | |
"'" << File.read($1).gsub(%r{$}, '\\').chop << "'" | |
}.gsub!(%r{/\*>\s*(.+?)\s*\*/}) { | |
File.read($1) | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment