Module: Bundlebun::Integrations::Jsbundling

Defined in:
lib/bundlebun/integrations/jsbundling.rb

Overview

A Bundlebun integration for jsbundling-rails.

It’s hard to override those methods on the fly, and a Rails initializer in the target project also does not seem to work, so we have to create a dummy task in the actual Rails project, and patch the helper module Tasks from there.

When installed, makes it run a bundled Bun runtime for packing tasks.

See: github.com/rails/jsbundling-rails/blob/main/lib/tasks/jsbundling/build.rake

Defined Under Namespace

Modules: Tasks

Class Method Summary collapse

Class Method Details

.bun!Object

Patches the existing module.

Call this after everything is loaded and required. For a Rails application, a good place is… not an initializer, but some code that can be run in a Rake task. Like a custom Rake task in lib/tasks.

See the documentation for more info on installation Rake tasks.



23
24
25
26
27
# File 'lib/bundlebun/integrations/jsbundling.rb', line 23

def self.bun!
  return unless defined?(::Jsbundling::Tasks)

  ::Jsbundling::Tasks.prepend(self::Tasks)
end