Class: Nodeify::JavaScript
- Inherits:
-
Sprockets::DirectiveProcessor
- Object
- Sprockets::DirectiveProcessor
- Nodeify::JavaScript
- Defined in:
- lib/nodeify/java_script.rb
Instance Method Summary collapse
Instance Method Details
#evaluate(context, options, &blk) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/nodeify/java_script.rb', line 6 def evaluate(context, , &blk) super file_path = file + '.tmp' File.open(file_path, 'w') { |f| f.puts @result } @result = `node -e "var browserify = require('browserify'), _ = process.stdout.write(browserify({ entry: '#{file_path}', require: { http: 'http-browserify' } }).bundle());"` FileUtils.rm_f file_path @result end |