0.0
No commit activity in last 3 years
No release in over 3 years
Rollup for Sprockets and the Rails asset pipeline
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

Runtime

>= 1.5.4
 Project Readme

Gem Version build

Jass::Rollup – Rollup for Sprockets and the Rails asset pipeline

Jass::Rollup integrates the Rollup JS bundler with Sprockets and the Rails asset pipeline.

💡 Motivation

JavaScript build pipelines tend to be a complicated mess consisting of dev servers, an infinite number of npm dependencies and other "opinionated" conventions (and lack thereof).

The Jass gem series provide a straightforward way of integrating modern JS tooling with the existing Rails asset pipeline, while adhering to established workflows for asset processing in Rails applications.

📦 Installation

Gemfile

gem 'jass-rollup'

JS dependencies

Add rollup to your JS dependencies:

$ yarn add rollup @rollup/plugin-commonjs @rollup/plugin-node-resolve

Node.js

Jass::Rollup depends on Nodo, which requires a working Node.js installation.

⚡️ Usage

Jass::Rollup provides two new directives to use in your JS assets, as well as a new Sprockets file extension for rollup bundle config files.

rollup

The rollup directive will invoke Rollup with the given entry point relative to your Rails.root.

To bundle an entry point as ES module:

//= rollup app/javascript/entry.js

To bundle a npm module as ES module:

//= rollup vendor/node_modules/rxjs/dist/esm5/index.js

rollup_esm

The require_esm directive will bundle a npm module referenced by its name as ES module:

//= rollup_esm currency.js

Bundling with custom rollup configurations

If your Rollup bundle requires extra configuration options, e.g. plugins, the file extension .rollup can be used:

// assets/javascript/main.js.rollup
export default {
  input: 'app/javascript/entry.js',
  output: {
    format: 'es'
  }
};

This asset will be bundled to main.js.

💎 Other Jass gems for the asset pipeline

Jass::Esbuild – esbuild support for Sprockets

Jass::Vue::SFC – Vue Single File Component support for Sprockets

Jass::React::JSX – React JSX support for Sprockets