Run Ruby in your HTML.
<script type="text/ruby">
puts 'Hello, world!'
</script>
This library is built using ruby.wasm, and greatly inspired by PyScript.
Import the RbScript file to your HTML:
<script defer src="https://cdn.jsdelivr.net/npm/rbscript/dist/rbscript.umd.js"></script>
You can execute Ruby codes written in the <script>
tag with text/ruby
type.
<script type="text/ruby" src="./greeting.rb"></script>
<script type="text/ruby">
puts 'Hi!'
</script>
You can specify callback functions using data attributes whose name starts with rb-
.
<button data-rb-onclick="greeting">Hi!</button>
<script type="text/ruby">
def greeting(event)
puts 'Hi!'
end
</script>
Licensed under the MIT license.