What about using pagespeed for nginx? https://www.modpagespeed.com/doc/filter-prioritize-critical-css
And for static: https://discourse.roots.io/t/removing-unused-css-with-purgecss-uncss/11586/2