S
As I understood you are trying to manage it via scss code. The method looks good, but I think it is easier to do in a post-build step by transforming bundled HTML and CSS files using PostCSS. I have created a tool that can help with extracting media related rules into dedicated files. Have a look if you are interested ) github: levchak0910/css-media-splitter