Error rendering `_frontend/scripts/load-boomerang-iframe.twig` -> JSMin: Unterminated String at byte 201:
Describe the bug
When using webperf 5.0.0 with craft-minify 5.0.0, the boomerang iframe loader script throws a JSMin minification error: JSMin: Unterminated String at byte 201: ',
To reproduce
Steps to reproduce the behaviour:
- Install nystudio107/craft-webperf version 5.0.0
- Install nystudio107/craft-minify version 5.0.0
- Enable webperf beacon on a page
- Load the page in browser
- See error message: Error rendering '_frontend/scripts/load-boomerang-iframe.twig' -> JSMin: Unterminated String at byte 201: ',
Expected behaviour
A clear and concise description of what you expected to happen.
The boomerang iframe loader script should be rendered without minification errors, or the problematic JavaScript should be escaped in a way that's compatible with JSMin.
Versions
Plugin version: 5.0.0 Craft version: 5.8.19 craft-minify version: 5.0.0 mrclay/jsmin-php version: 2.4.3
Sorry I did miss this one. I'll have a look at it today, I'm not sure if the issue lies with Minify, Webperf, or more likely a change in jsmin-php because the former two haven't changed in the interim.
Same as: https://github.com/nystudio107/craft-webperf/issues/57
The boomerang iframe loader script should be rendered without minification errors, or the problematic JavaScript should be escaped in a way that's compatible with JSMin.
Versions
Plugin version: 5.0.0 Craft version: 5.8.19 craft-minify version: 5.0.0 mrclay/jsmin-php version: 2.4.3
According to my newly generated composer.lock file, I have the following versions installed:
"name": "craftcms/cms",
"version": "5.8.21",
"name": "nystudio107/craft-webperf",
"version": "5.0.0",
"name": "nystudio107/craft-minify",
"version": "5.0.0",
"name": "mrclay/jsmin-php",
"version": "2.4.3",
...all of which match the versions you have installed. With these versions installed, I'm unable to reproduce the issue, either in local development (which minimizing doesn't happen) or in production (where I verified that the minification is happening).
Is there any chance that craft-webperf has been modified in some way? Have you tried re-installing it from scratch?
Can you check to see that your _frontend/scripts/load-boomerang-iframe.twig file matches exactly the file here? https://github.com/nystudio107/craft-webperf/blob/develop-v5/src/templates/_frontend/scripts/load-boomerang-iframe.twig
Additional questions @bart-honcho @smcservices
- Can you reproduce this issue in both local development in and production? For local development, ensure that
devModefor Craft CMS is off so that it attempts to do the JS minification - If so, can you also reproduce this issue on any other websites/projects that are using Webperf?
Hi there, @khalwat thank you for looking into this. Y es I could see the issue both locally and on production. The vendor files haven't been modified in any way I will re-install, test and get back to you - thanks!
@bart-honcho okay thanks, let me know. If you do still experience it, please provide your PHP version as well.
@bart-honcho any luck?