Viewing 15 replies - 1 through 15 (of 33 total)
  • +1

    Same problem here. In my case the included minified CSS breaks even the design of AMP pages.

    Thread Starter cybmeta

    (@cybmeta)

    Unfortunately W3TC seems abandoned. The developer has not been active for 4 months, the compatible version has not been update since WordPress 4.3.3 and there are users who has bought Pro license but they don’t recieve support.

    I’m afraid that we need to look for another solution. WP Rocket seems good but it is not free and it is also not compatible with AMP.

    Hi,

    Jonathan from WP Rocket here.

    WP Rocket is 100% compatible with AMP since today and the 2.6.16 version ??

    Have a nice day!

    Thread Starter cybmeta

    (@cybmeta)

    Thank you WP Media for the update. Unfortunately a paid service is not affordable for everyone, even if it is the best service.

    A very quick fix for W3TC. In the file plugins/w3-total-cache/lib/W3/Plugin/Minify.php, line 139:

    if( function_exists('is_amp_endpoint') && is_amp_endpoint() ) {
        $add_script_and_style = false;
    } else {
        $add_script_and_style = true;
    }
    if ( function_exists('is_feed') && ! is_feed() && $add_script_and_style ) {

    Please, note that it is a very quick fix; there can be a better solution.

    @cybmeta This fixed worked for me. However I still get a

    NS_ERROR_UNEXPECTED:

    After my ‘amp validation successful’ message.

    Thoughts?

    Thread Starter cybmeta

    (@cybmeta)

    @coop920 that error has nothing to do with the issue we are talking about; I think it is better if you start a new thread for that.

    Thread Starter cybmeta

    (@cybmeta)

    Please @coop920, start a new thread if you want to talk about something different, this thread was open to talk about W3TC conflict with AMP plugin. Stop talking about another non-related things. I hope you understand that making a thread open to every issues is not good for any user who come here looking for help about AMP plugin and W3TC. Your issue had nothing to do with W3TC and AMP plugin.

    @cybmeta Thanks for that solution.

    I’m wondering if there would be a way to deregister the stylesheet and script file after W3TC creates them, so that the plugin doesn’t have to get patched directly.

    Thread Starter cybmeta

    (@cybmeta)

    Good point @teaperson200

    As I said, the solution is a “very quick” fix, it is intended to fix the problem until a proper solution is found.

    I’ve not looked very deeply into W3TC code but it seems that minified CSS and JS files generated by W3TC are not enqueued nor registered, they are injected into the document DOM, so they can not be deregistered.

    Thread Starter cybmeta

    (@cybmeta)

    Of course, you can set “/amp” (or the amp endpoint you use) in the “Never minify the following pages”. It fix the problem with CSS and JS files without hacking the pllugin, but the HTML minification is also disable.

    @cybmeta Thank you! The latter solution is the simple thing I was looking for. My pages are pretty small so HTML minification is not a serious issue.

    For me using Tidy CSS minifier solve my problem. It’s in option panel of W3 TC

    Thread Starter cybmeta

    (@cybmeta)

    The issue here is not about minifiyng CSS, JS or HTML. It is about they being added to AMP pages when that pages should not include any CSS file and only allowed JS. I can not imaging how chaning the minify method can fix the issue. @dinhtungdu Can you explain it? I’ve tested and, as I expected, it didn’t work.

    @cybmeta:
    I read your question again and I think you may set minify mode is manual.

    For me, I set auto mode for Minify, my AMP page doesn’t come with css from theme. But I come with another problem: the minifier auto stripped last semi-colon of css, so it breaks AMP validation. After I change CSS Minifier, my last semi-colons are kept in my minified HTML => AMP works!.

    Sorry because of too quick answer. ??

Viewing 15 replies - 1 through 15 (of 33 total)
  • The topic ‘Disable on AMP pages’ is closed to new replies.