Title: JavaScript comment removal doesn&#039;t work
Last modified: August 30, 2016

---

# JavaScript comment removal doesn't work

 *  Resolved [stevelock](https://wordpress.org/support/users/stevelock/)
 * (@stevelock)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/javascript-comment-removal-doesnt-work/)
 * Hi there,
 * First of all: great plugin, it’s doing some great stuff! However, JavaScript 
   comments like the one below aren’t stripped from the optimized javascripts:
 *     ```
       /*!
       * LayerSlider
       */
       ```
   
 * To me it seems such comments can be removed safely right?
 * [https://wordpress.org/plugins/autoptimize/](https://wordpress.org/plugins/autoptimize/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/javascript-comment-removal-doesnt-work/#post-6212492)
 * that’s an special type of comment (cfr. the exclamation mark) typically used 
   to hold licensing info. as such, JS optimizers (including JS minify which AO 
   uses internally) [leave those comments in](https://github.com/mrclay/minify/blob/master/min/lib/JSMin.php#L16).
 * hope this explains,
    frank
 *  [millllan](https://wordpress.org/support/users/millllan/)
 * (@millllan)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/javascript-comment-removal-doesnt-work/#post-6212696)
 * Any way to go around this? i would love if google pagespeed test would not complain
   about a few bytes that could be minified…
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/javascript-comment-removal-doesnt-work/#post-6212701)
 * Well, if you’re (a little bit) into coding, you could hook into AO’s autoptimize_js_after_minify
   filter (as [applied here](https://github.com/futtta/autoptimize/blob/master/classes/autoptimizeScripts.php#L191))
   to remove the “important comment block” yourself.
 * frank
 *  [millllan](https://wordpress.org/support/users/millllan/)
 * (@millllan)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/javascript-comment-removal-doesnt-work/#post-6212718)
 * Its working, thanks! I commented out that line 191 and now it removes all the
   comments…
 * Google pagespeed score stays the same without that extra 1KB ( gziped I guess
   its even less ) so i guess its no use to do this… but my client will be happy.
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/javascript-comment-removal-doesnt-work/#post-6212719)
 * > I commented out that line 191 and now it removes all the comments…
 * that’s weird; line 191 does not remove comments, it’s a wordpress filter to alter
   the optimized JS (which would allow you to remove the comment yourself, if you
   would hook into that filter).
 * but if you’re happy, and the client will be happy, then who am I to complain?
   😉
 * kind regards,
    frank
 *  [millllan](https://wordpress.org/support/users/millllan/)
 * (@millllan)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/javascript-comment-removal-doesnt-work/#post-6212720)
 * i am not into coding, i just removed that line… here is the result file: [http://powerhouseworld.com/wp-content/cache/autoptimize/js/autoptimize_d39c2fd083991371801fc378ee27c924.js](http://powerhouseworld.com/wp-content/cache/autoptimize/js/autoptimize_d39c2fd083991371801fc378ee27c924.js)
 * No jquery comment at the begging, and all the other comments that were there 
   before …
 * and my pagespeed result
    [https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fpowerhouseworld.com%2F&tab=desktop](https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fpowerhouseworld.com%2F&tab=desktop)

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘JavaScript comment removal doesn't work’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 6 replies
 * 3 participants
 * Last reply from: [millllan](https://wordpress.org/support/users/millllan/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/javascript-comment-removal-doesnt-work/#post-6212720)
 * Status: resolved