• Resolved disturbed-pixel

    (@disturbed-pixel)


    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 “&raquo”. 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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Harry Jackson

    (@harryjackson1221)

    Hi @disturbed-pixel

    Sorry to hear you are having an issue with minify.

    I would love to see what we can do to help to resolve the issue you are facing. What HTML minify engine are you using?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    No activity dor a week. Marking topic as resolved!

    Thread Starter disturbed-pixel

    (@disturbed-pixel)

    Sorry, not had a chance to get back to you

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @disturbed-pixel

    No problem, can you please share What HTML minify engine are you using?

    Thread Starter disturbed-pixel

    (@disturbed-pixel)

    I was using the default minification engine, i had minify inline JS enabled.

    Since, i have made further tweaks and not experiencing this issue at present, (cant remember the settings) unfortunately i have another issue now that i will write up.

    Thanks

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,
    I am glad to know this issue is resolved!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘HTML Minify -> CDATA Issue’ is closed to new replies.