https://github.com/woxtu/rbscript
Run Ruby in your HTML
https://github.com/woxtu/rbscript
ruby
Last synced: 5 months ago
JSON representation
Run Ruby in your HTML
- Host: GitHub
- URL: https://github.com/woxtu/rbscript
- Owner: woxtu
- License: mit
- Created: 2022-05-30T19:08:49.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-07T12:24:47.000Z (about 4 years ago)
- Last Synced: 2025-08-20T05:06:03.727Z (10 months ago)
- Topics: ruby
- Language: TypeScript
- Homepage:
- Size: 44.9 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RbScript
[](https://www.npmjs.com/package/rbscript)
Run Ruby in your HTML.
```html
puts 'Hello, world!'
```
This library is built using [ruby.wasm](https://github.com/ruby/ruby.wasm), and greatly inspired by [PyScript](https://pyscript.net/).
## Installation
Import the RbScript file to your HTML:
```html
```
## Feature
### Ruby code execution
You can execute Ruby codes written in the `` tag with `text/ruby` type.
```html
<script type="text/ruby" src="./greeting.rb">
```
```html
puts 'Hi!'
```
### Event handling
You can specify callback functions using data attributes whose name starts with `rb-`.
```html
Hi!
def greeting(event)
puts 'Hi!'
end
```
## License
Licensed under the MIT license.