How do I minify inline CSS using Twig? Inside my html.html.twig template I've added a stylesheet inside the style elements using this.

{% include directory ~ '/css/base/style.css' %}


Is there a way that I can strip it for all whitespaces? Can I apply the CssOptimizer class to it in any way? Can I also strip the stylesheet for comments?
This is not the right way to integrate a .css file inside a twig file in drupal8. You should use the standard procedure as I mentioned below.

 {{ attach_library('bartik/messages') }} 

SO now for minifying the .css  you can use the 3rd party site- https://cssminifier.com/

So the after minifying the .css file, crate the library 


messages:
  css:
    theme:
      css/components/my-minify.css: {}


Then attach the library in the twig by using the below sysntax


{{ attach_library('your-theme-name/messages') }}


Hope this will help you. If any doubt please don't hesitate to mention.