question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

minify-js not working?

See original GitHub issue

Probably user error, but “–minify-js true” isn’t working even though I have uglifyjs installed (npm install uglify-js -g). I’m sure this was working about 4 months ago when I last minified.

html-minifier \
                --collapse-whitespace --remove-comments --remove-optional-tags \
                --remove-redundant-attributes --remove-script-type-attributes \
                --remove-tag-whitespace --use-short-doctype --minify-css true \
                --minify-js true chooser.html-source > chooser.html

Output seems to still have <script> block un-minified:

</div></div></div><script>// test with:
  console.log("Starting")


  window.fbAsyncInit = function() {
    // console.log('FB init')
    FB.init({
      appId            : 'XXXX',
      autoLogAppEvents : true,
      xfbml            : true,
      version          : 'v3.1'
    });
    // console.log('FB check')

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

4reactions
adriaanvanrossumcommented, Apr 19, 2019

I have the same issue. Running:

html-minifier --minify-js true index2.html > index.html
$ html-minifier --version
4.0.0
0reactions
movahhedicommented, Jul 13, 2022

I’m still having this issue. I’m running it on a PHP-HTML-JS file with ignoreCustomFragments: [ /(<[%\?])([\s\S]*?)(([%|\?]>)|$(?![\r\n]))/ ].

Read more comments on GitHub >

github_iconTop Results From Across the Web

Minified JS causes JS to not work - Stack Overflow
Well, I have about 10 files that work fine, then when minified, they don't... I'm not sure exactly what doesn't work, there are...
Read more >
After minifying my JS is not working ! - Laracasts
Hi, When i run my laravel elixir gulp --production it minifying my js files with webpack but why it's not working after that...
Read more >
Minify JS not working - Netlify Support Forums
Minify JS under Deploy Settings, Asset optimization: isn't working for me. I have a plain HTML project, no build tools. CSS is being...
Read more >
Why isn't Auto Minify working? – Cloudflare Help Center
Once enabled, Cloudflare's Auto Minify will minify your HTML and your cached CSS and JS files. If you view the source of your...
Read more >
Minification not working for JS/CSS - Adobe Experience ...
Once you set the minify option in HTML Manager Configuration. Try restarting the bundle Adobe Granite UI Clientlibs com.adobe.granite.ui.clientlibs by stop/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found