Support » Plugin: W3 Total Cache » [Plugin: W3 Total Cache] Excluding code from minification

  • Is there any way to exclude some HTML from being minified, like through comments?

    The pagination of the main slider on the site looses it’s spacing, become bunched up, and moves to the top of the midbar.

    I think it is loosing a div or something and the CSS selector no longer applies.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Frederick Townes


    if your HTML is valid, minification will not affect layout. Check the W3C validator:

    You can add define statements listed in the FAQ usage section if you want to add a conditional statement to prevent a page from being minified.

    It’s valid under transitional and the errors I get while running strict have nothing to do with that part of code.

    It’s the homepage, so I might as well not turn on minification : )

    I set up a mirror here if you want to take a look. Email me and I can give you an admin login. It is not configured to do inline JS.

    Plugin Author Frederick Townes


    Email sent.

    Any luck? I have had success with other minifiers- maybe you should just include multiple engines on the next release…

    Plugin Author Frederick Townes


    I’m not able to duplicate the issue. What minify engines would you suggest?

    I had a similar problem and found that it was due to some comment that had not been closed correctly.

    I had a piece of JS which started with the following comment;

    <!– comment

    There was no closed bracket so the HTML minification messed up so it might be worth double checking your code to ensure there are some –> closing all comments.

    sorry I meant use // for comments instead

    strange for some JS its still killing the code. For example

    This code – works

    <a href='//", 350, 400, "", 20, 20)'><img src="" width="120" height="60" border="0" align="absmiddle"></a>

    Becomes (when HTML minification is active) – and fails

    href=’JavaScript:openPopWin(“”, 350, 400, “”, 20, 20)’><img
    src=”” width=”120″ height=”60″ border=”0″ align=”absmiddle”>

    Looks like the space between the <a and the href= have been removed and seperated onto different lines

    OK, I solved this by avoiding any JS or CSS comment / line removal so when I activated HTML minification (again avoiding comment and line removal) everything worked.


    Plugin Author Frederick Townes



Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: W3 Total Cache] Excluding code from minification’ is closed to new replies.