enovatedesign / craft-style-inliner

A Twig tag for inlining styles in a template
MIT License
7 stars 4 forks source link

YII-BLOCK-HEAD, YII-BLOCK-BODY-BEGIN, YII-BLOCK-BODY-END tags show in output #19

Open jonleverrier opened 1 year ago

jonleverrier commented 1 year ago

I'm using Craft CMS v4.4.16.1 and Style Inliner v3.0.3.

When I use the following in my template:

{% inlinecss %}
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <style type="text/css">
            h1 { color: red }
        </style>
    </head>
    <body>
        <h1>Hello, world!</h1>
    </body>
</html>
{% endinlinecss %}

YII tags appear in the final output:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <style type="text/css">
            h1 { color: red }
        </style>
    &lt;</head>
<body>
<p>![CDATA[YII-BLOCK-HEAD]]&gt;
    </p>&lt;![CDATA[YII-BLOCK-BODY-BEGIN]]&gt;
        <h1 style="color: red;">Hello, world!</h1>
    &lt;![CDATA[YII-BLOCK-BODY-END]]&gt;
</body>
</html>
Screenshot 2023-08-04 at 17 45 15

If I remove the inlinecss tags, no YII tags appear in the final output, but no inline CSS either!

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <style type="text/css">
            h1 { color: red }
        </style>
    </head>
    <body>
        <h1>Hello, world!</h1>
    </body>
</html>
jonleverrier commented 1 year ago

same problem running Craft 4.4.17

jonleverrier commented 1 year ago

problem still there on Craft 4.5.0

Enovate-Jordan commented 1 year ago

Hi,

Following on from my previous reply in the other issue you created, please update this package to the latest version of 3.0.5 and let me know if that resolves your issue.

jonleverrier commented 1 year ago

Hi @Enovate-Jordan - I've just updated to 3.0.5 but the problem is still there

Enovate-Jordan commented 1 year ago

@jonleverrier can you confirm which versions of both craft and this plugin are locked to

jonleverrier commented 1 year ago

@Enovate-Jordan my projects composer.json

  "require": {
    "craftcms/cms": "4.5.2",
    "craftcms/commerce": "4.2.11",
    "craftcms/commerce-stripe": "3.1.1",
    "craftcms/postmark": "3.0.0",
    "doublesecretagency/craft-cpbodyclasses": "2.3.0",
    "enovatedesign/craft-style-inliner": "3.0.5",
    "miranj/craft-cryptographer": "1.1.0",
    "mmikkel/incognito-field": "1.3.0",
    "nystudio107/craft-twigpack": "4.0.0-beta.4",
    "putyourlightson/craft-sprig": "2.6.2",
    "spatie/craft-ray": "2.0",
    "verbb/default-dashboard": "2.0.0",
    "verbb/expanded-singles": "2.0.5",
    "verbb/timber": "1.0.2",
    "vlucas/phpdotenv": "^5.4.0",
    "yiisoft/yii2-redis": "^2.0",
    "youandmedigital/breadcrumb": "2.0.0"
  },
Enovate-Jordan commented 1 year ago

@jonleverrier Are you able to try downgrading craft again? I just tested this on "craftcms/cms": "4.4.17" and "enovatedesign/craft-style-inliner": "3.0.5" and it's working fine.

jonleverrier commented 1 year ago

@Enovate-Jordan Thanks for getting back to me. I can't downgrade at the moment on this particular project as it's going live! I'll try and spin up a new server running just the latest version of Craft CMS and Style Inliner 3.0.5 and see if the bug is still there.

As I mentioned, I can see the bug on Craft CMS 4.5.2 and Style Inliner 3.0.5. I have tried disabling all plugins and disabling modules to rule out any edge cases.

Enovate-Jordan commented 1 year ago

Hi @jonleverrier,

I've spun up a fresh install of craft and installed the style inliner. I'm running the latest version of craft 4.5.3 and the latest version of the style inliner 3.0.5. I can confirm that the style linlier is working as expected on these versions, perhaps try and update to the latest version of craft as you previously mentioned.

emmavanderhaeghen commented 1 year ago

Hi, I am having the same issues here. I updated to the latest version of both craft and style inliner.

{ "require": { "campaignmonitor/createsend-php": "^7.0", "craftcms/cms": "4.5.6.1", "craftcms/feed-me": "5.2.0", "craftcms/google-cloud": "^2.0", "craftcms/guest-entries": "^3.0.0", "craftcms/postmark": "^3.0.0", "craftcms/redactor": "3.0.4", "doublesecretagency/craft-cpcss": "2.6.0", "enovatedesign/craft-style-inliner": "3.0.5", "gitonomy/gitlib": "^1.3", "nystudio107/craft-code-editor": "^1.0", "nystudio107/craft-plugin-manifest": "^4.0.0-beta.1", "nystudio107/craft-plugin-vite": "^4.0.0-beta.2", "nystudio107/craft-seomatic": "4.0.30", "nystudio107/craft-vite": "4.0.6", "putyourlightson/craft-snaptcha": "^4.0", "sebastianlenz/linkfield": "2.1.5", "spacecatninja/imager-x": "4.2.2", "spicyweb/craft-quick-field": "2.0.5", "verbb/default-dashboard": "^2.0", "vlucas/phpdotenv": "^3.4.0" },

jonleverrier commented 1 year ago

Any thoughts @Enovate-Jordan ?

jurdunnn commented 1 year ago

Oops sorry @jonleverrier @emmavanderhaeghen for the late response.

I'll have a look at this again today and get back to you

jurdunnn commented 1 year ago

Hi @jonleverrier @emmavanderhaeghen,

After incorporating @emmavanderhaeghen's composer json file into a new craft project and inserting the example snippet into the index.twig file, I have not been able to reproduce the problem.

It seems likely that there might be some conflicting configuration that both of you have made, which is causing the issue with the plugin. Could one of you please try testing this plugin on a fresh installation and configure the project to match the one where the problem is occurring, until it breaks again? This will hopefully provide me with more specific information to work with. Once I have that information, I will promptly address and resolve the issue.