Skip to content

Commit acaa4f3

Browse files
committed
Create sprockets manifest for example app
https://github.com/rails/sprockets/blob/070fc01947c111d35bb4c836e9bb71962a8e0595/UPGRADING.md#manifestjs Otherwise ``` ** Invoke generate:stuff (first_time) ** Execute generate:stuff bin/rake app:template LOCATION='../../example_app_generator/generate_stuff.rb' rake aborted! Sprockets::Railtie::ManifestNeededError: Expected to find a manifest file in `app/assets/config/manifest.js` But did not, please create this file and use it to link any assets that need to be rendered by your app: Example: //= link_tree ../images //= link_directory ../javascripts .js //= link_directory ../stylesheets .css and restart your server ``` This, however, fails on Rails < 7: ``` # --- Caused by: --- # Sprockets::Rails::Helper::AssetNotPrecompiled: # application.css ``` Without `application.css`: ``` Failure/Error: <%= stylesheet_link_tag "application" %> ActionView::Template::Error: The asset "application.css" is not present in the asset pipeline. ``` Without content in `manifest.js`: ``` Failures: 1) Welcomes GET /index returns http success Failure/Error: <%= stylesheet_link_tag "application" %> ActionView::Template::Error: Asset `application.css` was not declared to be precompiled in production. Declare links to your assets in `app/assets/config/manifest.js`. //= link application.css ```
1 parent af7d012 commit acaa4f3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

example_app_generator/generate_app.rb

+7
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,11 @@
7878
'REPLACE_BUNDLE_PATH',
7979
bundle_install_path
8080
chmod 'ci_retry_bundle_install.sh', 0755
81+
82+
if Rails::VERSION::STRING > '7'
83+
create_file 'app/assets/config/manifest.js' do
84+
"//= link application.css"
85+
end
86+
create_file 'app/assets/stylesheets/application.css'
87+
end
8188
end

0 commit comments

Comments
 (0)