I am facing a challenge with Tailwind CSS v3+ as it builds colors into the rgb space/color notation that is not compatible with an older browser (Safari 11) that my web app now needs to support.
For example,
rgb(163 160 158 / var(--tw-bg-opacity)
The issue lies with the space separators and the / opacity
syntax.
I have tried using regex perl operations to replace these elements in the build, but I could not find any information in the Tailwind CSS documentation regarding configuration or options for this.
npm run build && perl -pi -w -e 's/rgba?\\(\\s*\\d+)(\\s*\\s*\\d+)(\\s*\\s*\\d+) \\//rgba($1,$2,$3,/g)' dist/assets/index.*.css
However, my CI/CD deployment does not approve of this solution, and I believe there must be a more elegant way to address this issue.
Does anyone have suggestions for a better approach to handling this problem? How can I efficiently replace these elements without compromising functionality?
If it simplifies things, I do not use background-opacity in my application.
Thank you for your assistance.