Sprockets 4 and Webpacker Config/Wiki
Created by: niedfelj
- What were you trying to do?
Install administrate with webpacker/sprockets 4 using the wiki
- What did you end up with (logs, or, even better, example apps are great!)?
And error message about variables not being defined and about assets not being precompiled
- What versions are you running?
- Rails 6.0.3.4
- administrate 0.14.0
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.
- It seems the previous config/manifest.js had a line like this:
//= link_directory ../stylesheets .css
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 https://github.com/rails/sprockets/issues/597
- The fix for above is to change that line to just //= link application.css, but application.css by default has this line, which ultimately causes the same problem.
*= require_tree .
In the end I got it working by having this in my manifest.js:
//= link_tree ../images
//= link application.css
//= link administrate/application.css
And removing the require_tree . from application.css