You probably won't be able to use purge css to discard unnecessary css with the method you're advocating here since the classes won't already exist on the markup for purgecss to find.
That may or may not matter to you, but I think worth mentioning.
Thanks for the reply! I actually wrote about how to get the right purgecss extractor in a previous article to use this type of setup.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.