How to minify inline css using twig in drupal 8?

609 Views Asked by At

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?

1

There are 1 best solutions below

3
On

You could try to use the spaceless Tag

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