summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile19
1 files changed, 19 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index aa8614e..bc86f92 100644
--- a/Rakefile
+++ b/Rakefile
@@ -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