• Virtue 3.2.1 references the non-minified javascript asset main.js (from lib/scripts.php) although there is a minified version available. Is this an oversight or on purpose?

    (Another is widget_upload.js, but I believe only affects admin mode, so perhaps not as important.)

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey,
    It’s got to do with compatibility with certain minify plugins. There were issues reported with the minified version if it got re-minifed by another minify plugin. Since we suggest using minify plugins and caching it made more sense to leave the unminifed script as enqueue and prevent the odd minification error.
    Ben

    Thread Starter fastfasterfastest

    (@fastfasterfastest)

    OK, thanks.
    There is only a problem with main.js (and widget_upload.js) and not the other javascript assets that are enqueued minified?

    Was there an issue created here on this forum that you can point me to so I can see what the problem was?

    It would be good to figure out the underlying issue and fix that so all your javascript assets can be enqueued minified.

    It had to do with a minify plugin and there combine feature, not with the themes minify scripts. And it had to do with how the plugin loaded the combine scripts. The is_mobile function was causing infrequent errors. This was a while ago. And the issue came down strictly to the plugin a user was using. Since we suggest using a minify plugin it has not been a priority to push a needless change on the few individuals which experienced this issue.

    As I said it’s best that you use a minify plugin, like w3 total or autoptimize and have all your scripts from themes and plugins minifed.

    widget_upload.js is being changed in the next version.

    Thread Starter fastfasterfastest

    (@fastfasterfastest)

    Thanks.

    Although we don’t use a minify plugin, all our assets are already minified – except for that main.js.

    In main.js I see there are three variables isMobile, ua and isAndroid created in the global namespace. It would likely be better to use a IIFE instead and not pollute the global namespace.

    is_mobile function – did you mean the global variable isMobile in main.js? Perhaps the global isMobile (or ua or isAndroid) that are created there “clashed” with other scripts defining them as well, and the minify plugin that was used barfed on that. Perhaps using a IIFE will solve that issue that was encountered previously.
    Regardless, not introducing those three variables into the global namespace would be a good thing and a good change.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘non-minified javascript assets references’ is closed to new replies.