Now that Webpacker is riding off into the sunset, many of us find ourselves switching over to using one of the solutions offered by jsbuilding-rails.
The result of that being two files output to
application.css - and that’s where the hang-up occurs. If you are also using cssbundling-rails it will by default name it’s output the same thing -
application.css, causing a naming collision that will inevitably cause you to bang your head against the wall if you aren’t sure what’s going on.
There are two solutions here, one is renaming the output of your
cssbundling-rails file, or renaming your
app/assets/build. Then all you need to do is make sure you include those files in the head of your
If you’re not starting fresh in Rails 7 there’s good chance you’ve got files in
app/assets/config/manifest.js, just make sure you’ve got the following line in the config:
Of course you could also use
Also note that doing this also assumes that you’ve renamed your esbuild output file to
application-esbuild.jsas mentioned above, otherwise you’d run into similar naming collision issues that Gotcha #1 covers.
Top comments (0)