This repository was archived by the owner on Mar 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-16
lines changed Expand file tree Collapse file tree 2 files changed +9
-16
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,15 @@ class Engine < ::Rails::Engine
20
20
21
21
config . assets . precompile += config . requirejs . precompile
22
22
23
+ # Check for the existence of the requirejs:precompile:all top-level Rake task and disable asset pipeline
24
+ # compression to ensure that `r.js` gets uncompressed assets.
25
+ Rake . application . top_level_tasks . each do |task_name |
26
+ case task_name
27
+ when "requirejs:precompile:all"
28
+ config . assets . js_compressor = false
29
+ end
30
+ end if defined? ( Rake . application )
31
+
23
32
manifest_directory = config . assets . manifest || File . join ( ::Rails . public_path , config . assets . prefix )
24
33
manifest_path = File . join ( manifest_directory , "rjs_manifest.yml" )
25
34
config . requirejs . manifest_path = Pathname . new ( manifest_path )
Original file line number Diff line number Diff line change @@ -77,19 +77,6 @@ OS X Homebrew users can use 'brew install node'.
77
77
"requirejs:precompile:run_rjs" ,
78
78
"requirejs:precompile:digestify_and_compress" ]
79
79
80
- task :disable_js_compressor do
81
- # Ensure that Sprockets doesn't try to compress assets before they hit
82
- # r.js. Failure to do this can cause a build which works in dev, but
83
- # emits require.js "notloaded" errors, etc. in production.
84
- #
85
- # Note that a configuration block is used here to ensure that it runs
86
- # after the environment ("config/application.rb",
87
- # "config/environments/*.rb") has been set up.
88
- Rails . application . config . assets . configure do |env |
89
- env . js_compressor = false
90
- end
91
- end
92
-
93
80
# Invoke another ruby process if we're called from inside
94
81
# assets:precompile so we don't clobber the environment
95
82
#
@@ -160,6 +147,3 @@ OS X Homebrew users can use 'brew install node'.
160
147
end
161
148
162
149
task "assets:precompile" => [ "requirejs:precompile:external" ]
163
- if ARGV [ 0 ] == "requirejs:precompile:all"
164
- task "assets:environment" => [ "requirejs:precompile:disable_js_compressor" ]
165
- end
You can’t perform that action at this time.
0 commit comments