Separate JavaScript Importmaps For Rails Engines Discussion
Good stuff! I have an idea for another episode/lesson:
When using TailwindCSS (which is pretty much the standard nowadays) in an Rails app, I found myself wanting to build "plugins" or extended functionality nby using engines. I would be very cool to have a way to automatically scan the views in the engine when creating the TailwindCSS output (using the TailwindConfig from the main app). I've seen some examples that precompiles a css-bundle in the engine and then include it in the main app.
Maybe this is a solved problem? :)
To do that, you'd need to have a way to dynamically add the engine folders to the tailwind.config.js
in the parent app. That runs Node, but you could probably have it run a Rails command to get a list of folders that you parse an add to the content: []
dynamically.
The main reason for keeping separate, precompiled CSS for engines is that they don't require the parent app to run Tailwind or any other framework that way.
Friendly heads up: The video aspect ratio is off and the video seems slightly squished horizontally (or at least, as I can see). Just wanted to let you know. Otherwise, great video, thank you!