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 1
1
PATH
2
2
remote: .
3
3
specs:
4
- requirejs-rails (0.9.3 )
4
+ requirejs-rails (0.9.4 )
5
5
railties (>= 3.1.1 )
6
6
7
7
GEM
Original file line number Diff line number Diff line change @@ -20,12 +20,13 @@ 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.
23
+ # Check for the `requirejs:precompile:all` top-level Rake task and run the following initialization code.
25
24
Rake . application . top_level_tasks . each do |task_name |
26
25
case task_name
27
26
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
29
30
end
30
31
end if defined? ( Rake . application )
31
32
Original file line number Diff line number Diff line change @@ -94,6 +94,14 @@ OS X Homebrew users can use 'brew install node'.
94
94
95
95
requirejs . config . source_dir . mkpath
96
96
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
+
97
105
requirejs . env . each_logical_path do |logical_path |
98
106
m = bower_json_pattern . match ( logical_path )
99
107
bower_logical_path = m && "#{ m [ 1 ] } #{ js_ext } "
@@ -104,12 +112,16 @@ OS X Homebrew users can use 'brew install node'.
104
112
asset = requirejs . env . find_asset ( logical_path )
105
113
106
114
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.
108
116
filename = requirejs . config . source_dir . join ( bower_logical_path || asset . logical_path )
109
117
filename . dirname . mkpath
110
118
asset . write_to ( filename )
111
119
end
112
120
end
121
+
122
+ # Restore the original JS compressor and cache.
123
+ requirejs . env . js_compressor = original_js_compressor
124
+ requirejs . env . cache = original_cache
113
125
end
114
126
115
127
task generate_rjs_driver : [ "requirejs:setup" ] do
You can’t perform that action at this time.
0 commit comments