1

I am working on externalizing some of an app's functionality, so that we can use it across multiple apps. The functionality in question contains several ViewComponent's that use TailwindCSS for CSS. These CSS classes work as expected when the files are contained internal to the app, but fail to be loaded when the files are externally contained in the gem. Likely due to them now being external to the TailwindCSS config's content.

The methods I have tried are:

  • Including CSS through an Engine in the gem as mentioned in this blog
  • Safelisting classes which works, but requires that the end user add all required classes into the main app. I am hoping for a more dynamic approach to avoid hard coding classes.
  • Following the Third-Party library instructions to attempt to hack together a Gem way of dynamically adding the files to content. (Can be linked to via Github if that is an option)

Most promising to me seems to be the third-party options, which unfortunately caters to NPM packages, while I am trying to do the same with a Ruby gem. Any pointers on including via a link for dynamically loading the classes would be appreciated!

Chase McDougall
  • 211
  • 2
  • 7

0 Answers0