This repository was archived by the owner on Mar 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Expand file tree Collapse file tree 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 11PATH
22 remote: .
33 specs:
4- requirejs-rails (0.9.3 )
4+ requirejs-rails (0.9.4 )
55 railties (>= 3.1.1 )
66
77GEM
Original file line number Diff line number Diff line change @@ -20,12 +20,13 @@ class Engine < ::Rails::Engine
2020
2121 config . assets . precompile += config . requirejs . precompile
2222
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.
23+ # Check for the `requirejs:precompile:all` top-level Rake task and run the following initialization code.
2524 Rake . application . top_level_tasks . each do |task_name |
2625 case task_name
2726 when "requirejs:precompile:all"
28- config . assets . js_compressor = false
27+ # Enable class reloading so that Sprockets doesn't freeze the assets environment. This allows settings
28+ # for JS compression to be changes on a per-file basis.
29+ config . cache_classes = false
2930 end
3031 end if defined? ( Rake . application )
3132
Original file line number Diff line number Diff line change @@ -94,6 +94,14 @@ OS X Homebrew users can use 'brew install node'.
9494
9595 requirejs . config . source_dir . mkpath
9696
97+ # Save the original JS compressor and cache, which will be restored later.
98+
99+ original_js_compressor = requirejs . env . js_compressor
100+ requirejs . env . js_compressor = false
101+
102+ original_cache = requirejs . env . cache
103+ requirejs . env . cache = nil
104+
97105 requirejs . env . each_logical_path do |logical_path |
98106 m = bower_json_pattern . match ( logical_path )
99107 bower_logical_path = m && "#{ m [ 1 ] } #{ js_ext } "
@@ -104,12 +112,16 @@ OS X Homebrew users can use 'brew install node'.
104112 asset = requirejs . env . find_asset ( logical_path )
105113
106114 if asset
107- # If a `bower.json` was found, then substitute the logical path for the parsed module name.
115+ # If a `bower.json` was found, then substitute the logical path with the parsed module name.
108116 filename = requirejs . config . source_dir . join ( bower_logical_path || asset . logical_path )
109117 filename . dirname . mkpath
110118 asset . write_to ( filename )
111119 end
112120 end
121+
122+ # Restore the original JS compressor and cache.
123+ requirejs . env . js_compressor = original_js_compressor
124+ requirejs . env . cache = original_cache
113125 end
114126
115127 task generate_rjs_driver : [ "requirejs:setup" ] do
You can’t perform that action at this time.
0 commit comments