-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sprockets 4 and Webpacker Config/Wiki #1816
Comments
Thank you @niedfelj Your solution saves me tons of time to figure out the below issue when I am deploying to production. ActionView::Template::Error (The asset "administrate/application.css" is not present in the asset pipeline |
Thanks for finding this out! Do you think you'd be able to update the wiki entry with your findings? Unfortunately, until we have a better solution that's our best approach so far. |
I am running into a similar issue (getting In my debugging research I also ran across this section from the Rails Guides on Getting Started with Engines > 6.5 Separate Assets & Precompiling: when dealing with situations "where your engine's assets are not required by the host application",
Applying this change to the local version of my administrate gem fixed the problem: module Administrate
class Engine < ::Rails::Engine
isolate_namespace Administrate
initializer "administrate.assets.precompile" do |app|
app.config.assets.precompile += %w( administrate/application.js administrate/application.css )
end
# ... This seemed like a cleaner solution than requiring all end users to add I'm not very well versed with the details of Sprockets, so not sure what side effects the above code might have which would affect users with other setups. |
Install administrate with webpacker/sprockets 4 using the wiki
And error message about variables not being defined and about assets not being precompiled
It seems that the latest rails uses sass-rails 6 and sprockets 4 which creates a few issues for the current wiki instructions and webpacker.
When generating the assets from administrate to modify for the webpacker js changes, it will compile all of the .css under stylesheets out of order and throw errors about things like base/form not having variables defined.
More details here rails/sprockets#597
In the end I got it working by having this in my manifest.js:
And removing the require_tree . from application.css
The text was updated successfully, but these errors were encountered: