File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -66,8 +66,16 @@ def configure(&block)
66
66
67
67
manifest_path = File . join ( app . root , 'public' , config . assets . prefix )
68
68
69
- unless config . assets . version . blank?
70
- app . assets . version += "-#{ config . assets . version } "
69
+ # Configuration options that should invalidate
70
+ # the Sprockets cache when changed.
71
+ version_fragments = [
72
+ config . assets . version ,
73
+ config . action_controller . relative_url_root ,
74
+ config . action_controller . asset_host
75
+ ] . compact . join ( '-' )
76
+
77
+ if version_fragments . present?
78
+ app . assets . version += "-#{ version_fragments } "
71
79
end
72
80
73
81
# Copy config.assets.paths to Sprockets
Original file line number Diff line number Diff line change @@ -109,6 +109,18 @@ def test_version
109
109
assert_equal "test-v2" , env . version
110
110
end
111
111
112
+ def test_version_fragments
113
+ app . configure do
114
+ config . assets . version = 'v2'
115
+ config . action_controller . asset_host = 'http://some-cdn.com'
116
+ config . action_controller . relative_url_root = 'some-path'
117
+ end
118
+ app . initialize!
119
+
120
+ assert env = app . assets
121
+ assert_equal "test-v2-some-path-http://some-cdn.com" , env . version
122
+ end
123
+
112
124
def test_configure
113
125
app . configure do
114
126
config . assets . configure do |env |
You can’t perform that action at this time.
0 commit comments