forked from rails/jquery-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rails#78 from fullbridge-batkins/master
Make minified versions of scripts included in production mode when asset pipeline is disabled
- Loading branch information
Showing
5 changed files
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
require "jquery/assert_select" if ::Rails.env.test? | ||
|
||
module Jquery | ||
module Rails | ||
class Engine < ::Rails::Engine | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# 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 Jquery | ||
module Rails | ||
|
||
class Railtie < ::Rails::Railtie | ||
config.before_configuration do | ||
|
||
if ::Rails.root.join("public/javascripts/jquery-ui.min.js").exist? | ||
jq_defaults = %w(jquery jquery-ui) | ||
jq_defaults.map!{|a| a + ".min" } if ::Rails.env.production? || ::Rails.env.test? | ||
else | ||
jq_defaults = ::Rails.env.production? || ::Rails.env.test? ? %w(jquery.min) : %w(jquery) | ||
end | ||
|
||
# Merge the jQuery scripts, remove the Prototype defaults and finally add 'jquery_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 | ||
config.action_view.javascript_expansions[:defaults] << 'jquery_ujs' | ||
end | ||
end | ||
|
||
end | ||
end |