What is the best way to import node_modules CSS in a Rails 7 Esbuild project?
Rails 7.0
Ruby 3.0.3
Esbuild / Tailwind
Question: what is the best way to import the CSS from a node package. After running the yarn add command, the JS loads very easily but as you know adding import css
in application.js will lead in having the application.css overwritten, what is not intended.
I could copy the node_module css files to the assets/javascript folder and the use @import in the application.tailwind.css file but that means that every time the node_module is upgraded (or during deployment) something will break...
I was considering adding Rails.application.config.assets.paths << "node_modules"
in the assets.rb file but not sure this is a good practice.
What are your recommendations?