Ability to load only used css for the blocks

Hi,

I am putting this as a feature request as I am not sure if this can be already done. I have a gutenberg block which have the select control type for css classes. It allows the user to select from 40 classes.

I want that the block only output the selected css in a stylesheet file instead of the stylesheet file holding all the classes. I see I can use inline attributes with more controls but that won’t get cached by the browsers. I need the css file to hold only the classes used and do not load the unused classes. Something like Tailwind JIT. May be any body can guide me in the right direction with this request?