afbora / kirby-blade

Enable Laravel Blade Template Engine for Kirby 3
MIT License
20 stars 7 forks source link

Broken HTML minification #22

Open S1SYPHOS opened 2 years ago

S1SYPHOS commented 2 years ago

Hey there, when turning on HTML minification, I get the following ParseError: syntax error, unexpected token ")"

Screenshot from 2022-06-24 12-00-55

When disabling HTML minification, everything works fine and behaves as expected (great plugin, thanks <3).

Now, even when just using <html></html> and nothing else. I know that it originates somewhere in symfony/css-selector and I can't figure out which ) and where it comes from - but it's certainly not from within my HTML being passed to kirby-blade.

afbora commented 2 years ago

Which version do you use?

S1SYPHOS commented 2 years ago

Currently v1.9.2, but I tried earlier versions, and it's all the same ..

S1SYPHOS commented 2 years ago

.. disabling doOptimizeViaHtmlDomParser helps, but deactivates most optimization steps along with it :wink:

S1SYPHOS commented 2 years ago

I tried pinpointing the issue disabling everything except doOptimizeViaHtmlDomParser, but to no avail:

# ...
'afbora.blade.minify.options' => [
    'doOptimizeViaHtmlDomParser' => true,
    'doRemoveComments' => false,
    'doSumUpWhitespace' => false,
    'doRemoveWhitespaceAroundTags' => false,
    'doOptimizeAttributes' => false,
    'doRemoveHttpPrefixFromAttributes' => false,
    'doRemoveHttpsPrefixFromAttributes' => false,
    'doKeepHttpAndHttpsPrefixOnExternalAttributes' => false,
    // 'doMakeSameDomainsLinksRelative' => false,  # see issue #23
    'doRemoveDefaultAttributes' => false,
    'doRemoveDeprecatedAnchorName' => false,
    'doRemoveDeprecatedScriptCharsetAttribute' => false,
    'doRemoveDeprecatedTypeFromScriptTag' => false,
    'doRemoveDeprecatedTypeFromStylesheetLink' => false,
    'doRemoveDeprecatedTypeFromStyleAndLinkTag' => false,
    'doRemoveDefaultMediaTypeFromStyleAndLinkTag' => false,
    'doRemoveDefaultTypeFromButton' => false,
    'doRemoveEmptyAttributes' => false,
    'doRemoveValueFromEmptyInput' => false,
    'doSortCssClassNames' => false,
    'doSortHtmlAttributes' => false,
    'doRemoveSpacesBetweenTags' => false,
    'doRemoveOmittedQuotes' => false,
    'doRemoveOmittedHtmlTags' => false,
],
# ...

.. still throws ParseError :disappointed: