Module: Bundlebun::Integrations::Cssbundling

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

Overview

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



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

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

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