Home › Forums › CSS › Grunt plugin to inline the contents of a css file › Reply To: Grunt plugin to inline the contents of a css file
June 22, 2017 at 4:37 pm
#256036
Participant
There is this grunt-copy plugin that I use for inlining CSS in a style-block. So in gruntfile.js
within a “copy task” one can copy anything and rename it to something else. Like, for example, copy a prefixed and minified build/css/critical.min.css
file to build/inc/critical-css.inc
.
Maybe you don’t need this but anyway: a PHP-include within those style tags can output this with the.inc
suffix. Or in a template language like twig:
{% if page.page_type == "post" %}<style>{% include "build/inc/critical-css.inc" %}</style>{% endif %}