Sha256: 2a8aeeed0f90f3797d5e5766c796e89290f226ca59fa673315a84e6a4d0157e6

Contents?: true

Size: 817 Bytes

Versions: 3

Compression:

Stored size: 817 Bytes

Contents

require "bundler/gem_tasks"

require 'opal'

Opal.append_path 'lib/opal'

def compile(filename, source)
  compiler = Opal::Compiler.new(source, file: File.basename(filename, '.rb'))
  compiler.compile
  File.binwrite(File.basename(filename, '.rb') + '.js',
                compiler.result.to_s <<
                  "//# sourceMappingURL=#{File.basename(filename, '.rb')}.js.map\n" <<
                  "//# sourceURL=#{File.basename(filename)}\n"
                  )
  File.binwrite(File.basename(filename, '.rb') + '.js.map', compiler.source_map.as_json.to_json.to_s )

end

task :dist do
  builder = Opal::Builder.new
  builder.build 'react'
  File.binwrite "dist/opal-react.js",     builder.to_s << "\n//# sourceMappingURL=opal-react.js.map\n"
  File.binwrite "dist/opal-react.js.map", builder.source_map.to_s
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
opal-react-0.0.5 Rakefile
opal-react-0.0.4 Rakefile
opal-react-0.0.3 Rakefile