You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With a pristine (`rails new`) Rails 8.0 app, the `app/assets/config/manifest.js` file
is no longer automatically generated. For engines still using sprockets,
that is not a huge issue, because they have and add their own manifest
files for their assets to the list of precompiled assets.
However, scripts like the Solidus bin/sandbox script[1] first run `rails
new`, then add the needed engines to the sandbox's `Gemfile`, then run
`rails db:migrate` and their respective install generators. With Rails
8, these scripts now fail before anything is possible in Ruby, because
the initializer of `Sprockets::Railtie` will raise an error on startup.
This commit changes the behavior of the Railtie to issue a deprecation
warning instead of raising an Exception.
[1] https://github.com/solidusio/solidus/blob/main/bin/sandbox#L44-L99
Copy file name to clipboardExpand all lines: lib/sprockets/railtie.rb
+14-17Lines changed: 14 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -60,21 +60,6 @@ module Sprockets
60
60
classRailtie < ::Rails::Railtie
61
61
includeSprockets::Rails::Utils
62
62
63
-
classManifestNeededError < StandardError
64
-
definitialize
65
-
msg="Expected to find a manifest file in `app/assets/config/manifest.js`\n" +
66
-
"But did not, please create this file and use it to link any assets that need\n" +
67
-
"to be rendered by your app:\n\n" +
68
-
"Example:\n" +
69
-
" //= link_tree ../images\n" +
70
-
" //= link_directory ../javascripts .js\n" +
71
-
" //= link_directory ../stylesheets .css\n" +
72
-
"and restart your server\n\n" +
73
-
"For more information see: https://github.com/rails/sprockets/blob/070fc01947c111d35bb4c836e9bb71962a8e0595/UPGRADING.md#manifestjs"
if ::Rails.root.join("app/assets/config/manifest.js").exist?
92
+
app.config.assets.precompile += %w(manifest.js)
93
+
else
94
+
msg="Expected to find a manifest file in `app/assets/config/manifest.js`\n" +
95
+
"But did not, please create this file and use it to link any assets that need\n" +
96
+
"to be rendered by your app:\n\n" +
97
+
"Example:\n" +
98
+
" //= link_tree ../images\n" +
99
+
" //= link_directory ../javascripts .js\n" +
100
+
" //= link_directory ../stylesheets .css\n" +
101
+
"and restart your server\n\n" +
102
+
"For more information see: https://github.com/rails/sprockets/blob/070fc01947c111d35bb4c836e9bb71962a8e0595/UPGRADING.md#manifestjs"
0 commit comments