tree-sitter/script/serve-docs

29 lines
538 B
Text
Raw Normal View History

#!/bin/bash
2019-04-24 16:58:30 -07:00
root=$PWD
cd docs
2019-04-24 16:58:30 -07:00
bundle exec jekyll serve "$@" &
bundle exec ruby <<RUBY &
require "listen"
2019-04-26 19:13:32 -07:00
def copy_wasm_files
`cp $root/target/release/*.{js,wasm} $root/docs/assets/js/`
2019-04-24 16:58:30 -07:00
end
2019-04-26 19:13:32 -07:00
puts "Copying WASM files to docs folder..."
copy_wasm_files
puts "Watching release directory"
listener = Listen.to("$root/target/release", only: /^tree-sitter\.(js|wasm)$/, wait_for_delay: 2) do
puts "WASM files updated. Copying new files to docs folder..."
copy_wasm_files
end
2019-04-24 16:58:30 -07:00
listener.start
sleep
RUBY
wait