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

    (@superpoincare)

    Thread Starter Forket

    (@forket)

    Unfortunately, not helps.
    I’ve added all needed scripts, they are combined based on rules (header, body, footer), but not minified.
    Here is extract (minify section) from my W3TC config

    Thread Starter Forket

    (@forket)

    Also, as I found. it doesn’t minify body(default.include-body) script.

    while header(default.include) and footer(default.include-footer) are minified

    Ramanan

    (@superpoincare)

    Quite strange.

    When I click the dropbox link of yours, the JS file for a flash of a second looks minified and then goes unminified.

    Possibly it might be due to the sourcemap lines in the code.

    Did you try to choose preserved comment removal and line break removal?

    Also does Google Pagespeed complain about the default-include-body file?

    Thread Starter Forket

    (@forket)

    GT Metrix report

    for now i have only preserved comment removal checked. Because with line break removal jquery doesn’t work (don’t know why. maybe it breaks something).

    Ramanan

    (@superpoincare)

    Something about avia.js and shortcode.js

    Other files in default-include-body are already minified.

    You could maybe try to use other plugins such as Autoptimize or WP-Minify-Fix to see if it solves and (by temporarily switching off W3TC Minify) and then get some clues as to why W3TC isn’t doing it.

    Thread Starter Forket

    (@forket)

    1. WP-Minify-Fix – its untested with WordPRess 4.3 But I’ve installed.
    2. Switched OFF minification in W3TC
    3. Configured plugin
    4. Page resresh
    5. RESULT – plugin made more mess than usefulness (loaded twice botstrap and other unexpected behaviour). Maybe because of it’s Incompatible with WP 4.3

    Ramanan

    (@superpoincare)

    Oops sorry to hear that. Autoptimize however is compatible with 4.3 as the author maintains his plugin.

    Thread Starter Forket

    (@forket)

    Some info while investigating.
    Minification goes with errors as you mentioned because of script avia-compat.js
    The reason – there is in start of script line: “use strict” with d/quotes. changed to s/quotes – also error in minified JS.
    ;'use strict'var avia_is_mobile=false;if – Uncaught SyntaxError: Unexpected token var

    Tried to delete – and there is no error. But it’s not OK to edit source JS (could be rewrited on update).
    Now another js file makes error. going for further investigation ??

    Interim conclusion: minification mechanism can’t work correctly with use strict

    UPDATE: And of course found a lot of information where people say: “Don’t use “use strict” in minified versions of JS”

    UPDATE 2: Is it possible to delete USE STRICT on minification process?

    Ramanan

    (@superpoincare)

    Yeah that’s right. Can be rewritten. Another reason is that security plugins such as Wordfence complain if you change something in a theme or plugin’s files.

    In my own case, I have managed to use W3TC with files which use “use strict”. So maybe the reason might be different.

    Thread Starter Forket

    (@forket)

    UPDATE 2: Is it possible to delete USE STRICT on minification process?
    And even make some checkbox in W3TC setting for user to chose “Remove use strict on minification?”
    :))))

    Thread Starter Forket

    (@forket)

    HAAAA!!! Found error in another JS file (from cleantalk) fixed it (and asked author to fix in future update) and now minification in async mode works like a charm :)))
    Only issue left: understand why include-body not minifying :(( and there are no errors in source JS files

    Thread Starter Forket

    (@forket)

    Take a look at screenshot

    Ramanan

    (@superpoincare)

    Be careful of async.

    It doesn’t solve dependencies.

    So if you have async for

    script1.js
    script2.js
    script3.js

    then if something in script2 or script3 depends on script1 or if something in script3 depends on script2 and/or script1, then it might not work.

    You could just simply put everything in the footer and use async, if that’s possible.

    Thread Starter Forket

    (@forket)

    And what in your opinion is best method for non-blocking way? “Defer”?

Viewing 15 replies - 1 through 15 (of 33 total)
  • The topic ‘Not mimified with minify switched ON’ is closed to new replies.