Sha256: c4ae811d04110e14c036e3b599c159e6000c3c300c79593bc24bae47682752bf

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

# Used to ensure that Rails 3.0.x, as well as Rails >= 3.1 with asset pipeline disabled
# get the minified version of the scripts included into the layout in production.
module Mootools
  module Rails
    class Railtie < ::Rails::Railtie
      config.before_configuration do
        if config.action_view.javascript_expansions
          if ::Rails.root.join('public/javascripts/mootools-more.min.js').exist?
            jq_defaults = %w(mootools mootools-more)
            jq_defaults.map! { |name| "#{name}.min" } if ::Rails.env.production? || ::Rails.env.test?
          else
            jq_defaults = ::Rails.env.production? || ::Rails.env.test? ? %w(mootools.min.min) : %w(mootools)
          end

          # Merge the MooTools scripts, remove the Prototype defaults and finally add 'mootools_ujs'
          # at the end, because load order is important
          config.action_view.javascript_expansions[:defaults] -= PROTOTYPE_JS + ['rails']
          config.action_view.javascript_expansions[:defaults] |= jq_defaults + ['mootools_ujs']
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mootools-rails-3.2.0 lib/mootools/rails/railtie.rb
mootools-rails-3.1.0 lib/mootools/rails/railtie.rb
mootools-rails-2.0.1 lib/mootools/rails/railtie.rb
mootools-rails-2.0.0 lib/mootools/rails/railtie.rb