This repository was archived by the owner on Mar 23, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -35,11 +35,26 @@ class Engine < ::Rails::Engine
35
35
end
36
36
end
37
37
38
- initializer "requirejs.manifest" , :after => "sprockets.environment" do |app |
39
- config = app . config
40
- if config . requirejs . manifest_path . exist? && config . assets . digests
41
- rjs_digests = YAML . load ( ERB . new ( File . new ( config . requirejs . manifest_path ) . read ) . result )
42
- config . assets . digests . merge! ( rjs_digests )
38
+ if ::Rails ::VERSION ::STRING >= "4.0.0"
39
+ config . after_initialize do |app |
40
+ config = app . config
41
+ rails_manifest_path = File . join ( app . root , 'public' , config . assets . prefix )
42
+ rails_manifest = Sprockets ::Manifest . new ( app . assets , rails_manifest_path )
43
+ if config . requirejs . manifest_path . exist? && rails_manifest
44
+ rjs_digests = YAML . load ( ERB . new ( File . new ( config . requirejs . manifest_path ) . read ) . result )
45
+ rails_manifest . assets . merge! ( rjs_digests )
46
+ ActionView ::Base . instance_eval do
47
+ self . assets_manifest = rails_manifest
48
+ end
49
+ end
50
+ end
51
+ else
52
+ initializer "requirejs.manifest" , :after => "sprockets.environment" do |app |
53
+ config = app . config
54
+ if config . requirejs . manifest_path . exist? && config . assets . digests
55
+ rjs_digests = YAML . load ( ERB . new ( File . new ( config . requirejs . manifest_path ) . read ) . result )
56
+ config . assets . digests . merge! ( rjs_digests )
57
+ end
43
58
end
44
59
end
45
60
You can’t perform that action at this time.
0 commit comments