0

Is there a way to filter all enqueued javascript files and remove all comment lines without using a plugin ?

2
  • I would advise against this, loading in the files in PHP and outputting them in PHP on each page load will take longer and wipe out any savings you make. It will not speed up your sites frontend transfer. Doing it reliably also means using an output buffer to store the entiire page, crippling time to first byte and time to first render, and eliminating progressive rendering in the browser, making your site appear slower, and giving potential SEO penalties.
    – Tom J Nowell
    Commented Jul 9, 2020 at 23:34
  • You could overwrite wp_enqueue_script to modify the minify Code. But it would more slowly that It has to be load the whole script then could compress your code.
    – RachC
    Commented Jul 10, 2020 at 0:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.