With Style Inliner 3.0.3 on Craft 4.4.13 (PHP 8.0) and {% criticalcss 'home' %} added to a template, I'm getting this error in errors log which breaks the site (white screen):
[01-Jun-2023 11:33:57 Australia/Brisbane] PHP Fatal error: Could not check compatibility between enovatedesign\styleinliner\twigextensions\CriticalCssNode::compile(Twig_Compiler $compiler) and Twig\Node\Node::compile(Twig\Compiler $compiler), because class Twig_Compiler is not available in /var/www/html/vendor/enovatedesign/craft-style-inliner/src/twigextensions/CriticalCssNode.php on line 23
[01-Jun-2023 11:33:57 Australia/Brisbane] PHP Fatal error: Uncaught Error: Class "enovatedesign\styleinliner\twigextensions\CriticalCssNode" not found in /var/www/html/vendor/enovatedesign/craft-style-inliner/src/twigextensions/CriticalCssTokenParser.php:40
Stack trace:
#0 /var/www/html/vendor/twig/twig/src/Parser.php(170): enovatedesign\styleinliner\twigextensions\CriticalCssTokenParser->parse(Object(Twig\Token))
#1 /var/www/html/vendor/twig/twig/src/TokenParser/BlockTokenParser.php(47): Twig\Parser->subparse(Array, true)
#2 /var/www/html/vendor/twig/twig/src/Parser.php(170): Twig\TokenParser\BlockTokenParser->parse(Object(Twig\Token))
#3 /var/www/html/vendor/twig/twig/src/Parser.php(83): Twig\Parser->subparse(NULL, false)
#4 /var/www/html/vendor/twig/twig/src/Environment.php(488): Twig\Parser->parse(Object(Twig\TokenStream))
#5 /var/www/html/vendor/twig/twig/src/Environment.php(516): Twig\Environment->parse(Object(Twig\TokenStream))
#6 /var/www/html/vendor/craftcms/cms/src/web/twig/Environment.php(39): Twig\Environment->compileSource(Object(Twig\Source))
#7 /var/www/html/vendor/twig/twig/src/Environment.php(348): craft\web\twig\Environment->compileSource(Object(Twig\Source))
#8 /var/www/html/vendor/twig/twig/src/Environment.php(309): Twig\Environment->loadTemplate('__TwigTemplate_...', 'index')
#9 /var/www/html/vendor/twig/twig/src/Environment.php(277): Twig\Environment->load('index')
#10 /var/www/html/vendor/craftcms/cms/src/web/View.php(465): Twig\Environment->render('index', Array)
#11 /var/www/html/vendor/craftcms/cms/src/web/View.php(518): craft\web\View->renderTemplate('index', Array)
#12 /var/www/html/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(56): craft\web\View->renderPageTemplate('index', Array, 'site')
#13 /var/www/html/vendor/yiisoft/yii2/web/Response.php(1098): craft\web\TemplateResponseFormatter->format(Object(craft\web\Response))
#14 /var/www/html/vendor/craftcms/cms/src/web/Response.php(286): yii\web\Response->prepare()
#15 /var/www/html/vendor/yiisoft/yii2/web/Response.php(339): craft\web\Response->prepare()
#16 /var/www/html/vendor/yiisoft/yii2/web/ErrorHandler.php(136): yii\web\Response->send()
#17 /var/www/html/vendor/craftcms/cms/src/web/ErrorHandler.php(192): yii\web\ErrorHandler->renderException(Object(yii\base\ErrorException))
#18 /var/www/html/vendor/yiisoft/yii2/base/ErrorHandler.php(323): craft\web\ErrorHandler->renderException(Object(yii\base\ErrorException))
#19 [internal function]: yii\base\ErrorHandler->handleFatalError()
#20 {main}
thrown in /var/www/html/vendor/enovatedesign/craft-style-inliner/src/twigextensions/CriticalCssTokenParser.php on line 40
Hi tyssen, this issue has already been resolved in version 3.0.4. Please upgrade the Style Inliner plugin to the latest version. Let me know if you are still having issues once you have done that.
With Style Inliner 3.0.3 on Craft 4.4.13 (PHP 8.0) and
{% criticalcss 'home' %}
added to a template, I'm getting this error in errors log which breaks the site (white screen):