Sha256: 83325dccab0b59efc34b68956ace7ebe7c6ddb7ff5112a2ae935f5c54749cbd8
Contents?: true
Size: 505 Bytes
Versions: 1
Compression:
Stored size: 505 Bytes
Contents
class JSPreprocessor def process(cwd, main_file) main = File.open(cwd + main_file).read.split "\n" compiled_file = recurse_includes(cwd, main).join "\n" end def recurse_includes(cwd, file) file.each_with_index do |line, index| if line.include? '#include' to_include = cwd + line[10..-2] + '.js' next_wd = Pathname.new(to_include).dirname.to_s + '/' file[index] = recurse_includes next_wd, File.open(to_include).read.split("\n") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jspreprocessor-0.0.1 | lib/JSPreprocessor.rb |