Sha256: 8b46d26ed5c9fb94f5feb0be7f372679ad895932acc5ac793b2ee431b702a2e9

Contents?: true

Size: 570 Bytes

Versions: 1

Compression:

Stored size: 570 Bytes

Contents

require 'tilt'
require 'fileutils'

module Nodeify
  class JavaScript < Tilt::Template
    attr_accessor :body

    def initialize(*arg)
      super
    end

    def prepare
    end

    def evaluate(context, options)
      output = ''
      file_path = file + '.tmp'
      File.open(file_path, 'w') { |f| f.puts data }
      output = `node -e "var browserify = require('browserify'), _ = process.stdout.write(browserify({ entry: '#{file_path}', require: { http: 'dkastner-http-browserify' } }).bundle());"`
      FileUtils.rm_f file_path
      output
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nodeify-0.0.5 lib/nodeify/java_script.rb