Skip to content

Instantly share code, notes, and snippets.

@NV
Created December 29, 2009 19:57
Show Gist options
  • Save NV/265546 to your computer and use it in GitHub Desktop.
Save NV/265546 to your computer and use it in GitHub Desktop.
Simple JS preprocessor with /*> file.js */
#!/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