• Resolved mewcrazy

    (@mewcrazy)


    Hello,

    I’m trying to modify the merged/minified js content. In fact I want to add obfuscation. How can I use your filters/actions to change the .min.js contents before it gets saved?

    – Dennis

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author launchinteractive

    (@launchinteractive)

    Hi Dennis,

    We don’t currently have a way for you to hook in and do this but it wouldn’t be too hard to add. Have a look at the compress_css and compress_js functions. If you manage to get it working send through your changes.

    Thread Starter mewcrazy

    (@mewcrazy)

    Hi,

    I just got it working. I simply added a filtermodify_js_output_before_save” into line 724 of merge-minify-refresh.php:

    if($should_minify)
    {
    // FILTER OUTPUT
    if($ext == 'js') $output = apply_filters( 'modify_js_output_before_save', $output );

    I’m not sure it is the best position for that filter, but it’s working flawlessly. It’s fired after the merge, and before the save.

    In my particular case I had to disable JS Minification in the plugin’s settings since my obfuscation is messing up with minified files. Luckily the obfuscated code is even more compressed than a regular minified file.

    I hope to see the filter in one of the upcoming versions.

    Thanks again!
    Dennis

    Plugin Author launchinteractive

    (@launchinteractive)

    Thanks Dennis,

    I have released the new version of MMR with your filter. I made a small change which allowed css to be filtered as well and moved the filter just before the check if MMR should minify the file. This will allow your filter to run even if MMR minification is turned off.

    Thread Starter mewcrazy

    (@mewcrazy)

    Updated and works. Thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Filter minified/merged scripts file’ is closed to new replies.