HTML Minify -> CDATA Issue
-
Hi,
Before posting i have tried to dig deeper, but it seems that every time i enable HTML minification i get the following errors (over 30) in the Chrome console:
Uncaught SyntaxError: Unexpected token ‘<‘
It’s related to every CDATA instance that the W3TC plugin wraps around any block of of inline Javascript. I have tried changing my document type to XHTML and XML encoding:
— php
header("Content-type: application/xhtml+xml"); echo '<?xml version="1.0" encoding="UTF-8"?>';
— html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Which prevents this error occurring, but then it gives me many more issues minifying anything after an ampersand for example “»”. Being that it’s strict.
I’m using HTML5 doctype declarations
<!DOCTYPE html>
How can i minify the HTML without the CDATA issue?I’ve seen posts talking about adding // before each CDATA block.
<script> //<![CDATA[ // insert code //]]> </script>
Can we add this automatically?
Please advise
Thanks
- The topic ‘HTML Minify -> CDATA Issue’ is closed to new replies.