Module: Bundlebun::Integrations::Jsbundling

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

Overview

A Bundlebun integration for [jsbundling-rails](github.com/rails/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.

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.

Examples:

Bundlebun::Integrations::Jsbundling.bun!


27
28
29
30
31
# File 'lib/bundlebun/integrations/jsbundling.rb', line 27

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

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