I'm developing a gem that acts as a library of view components integrated with Tailwind CSS. In this project, there's a crucial tailwind.config.js file where I specify the paths for building the tags used in the components. Here's a sample configuration:
module.exports = {
content: [
'./app/views/**/*.html.erb',
'./app/helpers/**/*.rb',
'./app/assets/stylesheets/**/*.css',
'./app/javascript/**/*.js',
'./app/components/**/*.rb'
]
}
My question revolves around determining the correct path to include for the gem's view components. Would it be something like my_gem/app/components/**/*.rb?
Additionally, I'm curious if there's a method to automate the addition of this path information upon installing the gem?
Gem.loaded_specs['your_gem_name'].full_gem_pathsounds like a good starting point to investigate intoThe idea is to be able to read
process.env.YOUR_GEM_COMPONENTS_PATHwithin tailwind.config.js, so there might be some tweaking to do around it.vite_rails provides a similar use case (engine link), this is how it is defined in the parent app, and how it is consumed in the vite config