diff options
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -22,3 +22,22 @@ begin rescue LoadError => e warn "#{e.path} is not available" end + +namespace :build do + desc 'Transcompile to JavaScript using Opal' + task :js do + require 'opal' + + builder = Opal::Builder.new(compiler_options: { + dynamic_require_severity: :error, + }) + builder.append_paths 'lib' + builder.build 'asciidoctor-interdoc-reftext' + + out_file = 'js/asciidoctor-interdoc-reftext.js' + + mkdir_p(File.dirname(out_file), verbose: false) + File.binwrite out_file, builder.to_s + File.binwrite "#{out_file}.map", builder.source_map + end +end |