Sha256: 542b7952f5ba5ca4c84169f6f769f7640151c2e094667ec13b7267b9f6be0693

Contents?: true

Size: 1.07 KB

Versions: 62

Compression:

Stored size: 1.07 KB

Contents

require 'sprockets/rails/task'

module Sprockets
  module Rails
    module Workarea
      # This is required because when precompiling assets in a deployed env
      # like staging or production, Rails.application.assets will be nil
      # because Rails.application.config.assets.compile = false. This means
      # "don't fall back to the asset pipeline if an asset can't be found",
      # which is what we want in those environvments.
      #
      # When Rails.application.assets == nil, sprockets-rails falls back and
      # uses it's own Sprockets::Environment. Since there is no
      # Sprockets::Environment for our app to add our plugin asset appends
      # points during initialization, we must monkey patch the ad hoc creation
      # of one for these rake tasks here to get these included. PRETTY SHITTY.
      #
      def environment
        result = super

        result.context_class.instance_eval do
          include ::Workarea::Plugin::AssetAppendsHelper
        end

        result
      end
    end
  end
end

Sprockets::Rails::Task.prepend(Sprockets::Rails::Workarea)

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.15 lib/workarea/ext/sprockets/task.rb
workarea-core-3.4.36 lib/workarea/ext/sprockets/task.rb
workarea-core-3.5.14 lib/workarea/ext/sprockets/task.rb
workarea-core-3.4.35 lib/workarea/ext/sprockets/task.rb
workarea-core-3.5.13 lib/workarea/ext/sprockets/task.rb
workarea-core-3.4.34 lib/workarea/ext/sprockets/task.rb
workarea-core-3.5.12 lib/workarea/ext/sprockets/task.rb
workarea-core-3.4.33 lib/workarea/ext/sprockets/task.rb
workarea-core-3.5.11 lib/workarea/ext/sprockets/task.rb
workarea-core-3.5.10 lib/workarea/ext/sprockets/task.rb
workarea-core-3.4.32 lib/workarea/ext/sprockets/task.rb
workarea-core-3.5.9 lib/workarea/ext/sprockets/task.rb
workarea-core-3.4.31 lib/workarea/ext/sprockets/task.rb
workarea-core-3.5.8 lib/workarea/ext/sprockets/task.rb
workarea-core-3.4.30 lib/workarea/ext/sprockets/task.rb
workarea-core-3.5.7 lib/workarea/ext/sprockets/task.rb
workarea-core-3.4.29 lib/workarea/ext/sprockets/task.rb
workarea-core-3.5.6 lib/workarea/ext/sprockets/task.rb
workarea-core-3.4.28 lib/workarea/ext/sprockets/task.rb
workarea-core-3.5.5 lib/workarea/ext/sprockets/task.rb