Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rerb

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rerb

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

RERB: WebAssembly Embedded Ruby

Use ERB/rhtml to build DOMs in ruby.wasm.

RERB is an unopinionated tool for compiling ERB/rhtml into ruby.wasm DOM operations for building the DOM tree described in the source file. Specifically, it generates code which, when run on a Ruby VM on WASM, generate the desired DOM. RERB is experimental and very young, so there are some usage caveats which you can read about here.

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add RERB

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install RERB

Usage

For Developers

The CLI is the recommended way to use RERB in development. The simplest way to call rerb would be to just do

rerb your-file.erb

RERB will compile this erb file into a HTML file which internally uses ruby.wasm DOM operations to generate the DOM in the erb file. If you want to save this output to a file, you can simply use the shell > operator to write the output into a file.

rerb your-file.erb > your-file.html

your-file.html is a fully valid HTML file, and is ready to be rendered on the browser, assuming the erb code itself contains all the necessary logic.

There are other flags which help you customize some aesthetics of the generated code. For example,

rerb --template nil your-file.erb

will generate just the DOM operations without the HTML boilerplate. This would be useful if you already have a HTML file and are simply looking to extend.

For Browsers

Running the code generated by RERB in a browser does not require RERB. It only needs ruby.wasm with the JS interop extension. This is easily available via CDN as shown here. Alternatively, you can use one of the templates which have all of this automatically set up.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Reading the capabilities (and limitations) is highly recommended. The current limitations of RERB listed in the document would be a great place to start looking for places to possibly contribute. Bug reports and pull requests are welcome on GitHub at https://github.com/forthoney/rerb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the rerb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

FAQs

Package last updated on 15 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc