Integrations
Ruby back-end servers
-
Rails integration is provided for both Webpacker and Sprockets. Rake tasks are provided to assist with the configuration. If you’re using the new jsbundling Rails 7 plugin, you’ll likely want to look at the front-end bundling instructions below.
-
Sinatra views may be used to produce JavaScript from Ruby, enabled by
require "ruby2js/sinatra"
-
CGI scripts may also be used to produce JavaScript from Ruby. This can be combined with Wunderbar to produce both HTML and JavaScript, enabled by
require "wunderbar/script"
. -
Haml scripts can be written in Ruby via a filter enabled by
require "ruby2js/haml"
JavaScript front-end build tools
A plugins is available for Vite which supports Hot Module Replacement and Refresh. The ESM
filter lets you author import
and export
statements, and the
autoexports and
autoimports options can often relieve you of the
need to do so.
JavaScript bundlers
An esbuild plugin, Rollup plugin, and a Webpack loader are available. Again, the ESM filter and autoexports and autoimports options are useful with bundlers.
Web Components
Filters are available for jQuery, Lit, React, and Stimulus. The React filter also supports Preact.
A Vue filter is available, but it has not yet been upgraded to support Vue3.
Node.js
A Node filter is available, as well as a register module. In most cases it will be the CJS filter rather than the ESM filter that you will want to use.