Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Javascript minifiers

Javascript minifiers

Scheduled Pinned Locked Moved The Lounge
javascriptpythoncomlearning
17 Posts 10 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Marc Clifton

    So I just tried 4 minifiers. Here are the results: [https://javascript-minifier.com/\](https://javascript-minifier.com/) Fails on class Helpers { [https://jscompress.com/\](https://jscompress.com/) Fails on class Helpers { [https://www.minifier.org/\](https://www.minifier.org/) Worked!!! Input was 81K, minimized is 46K. NUglify: [https://github.com/xoofx/NUglify\](https://github.com/xoofx/NUglify) Fails. Produced: Object.entries(t).map([n,t]=>i.setAttributeNS(null,n,t)) Note [n,t] needs to be ([n,t]) Too bad about NUglify. It produced a 37K minified file. 3 out of 4 failed. :sigh:

    Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

    T Offline
    T Offline
    Tim Carmichael
    wrote on last edited by
    #2

    Having never heard of a 'minifer', I followed the link that you said worked; OK, I understand what they are now. The next question is: does the page/site load noticeably faster when using the 'minifer'ed version? If so, what percent increase was seen?

    M G 2 Replies Last reply
    0
    • M Marc Clifton

      So I just tried 4 minifiers. Here are the results: [https://javascript-minifier.com/\](https://javascript-minifier.com/) Fails on class Helpers { [https://jscompress.com/\](https://jscompress.com/) Fails on class Helpers { [https://www.minifier.org/\](https://www.minifier.org/) Worked!!! Input was 81K, minimized is 46K. NUglify: [https://github.com/xoofx/NUglify\](https://github.com/xoofx/NUglify) Fails. Produced: Object.entries(t).map([n,t]=>i.setAttributeNS(null,n,t)) Note [n,t] needs to be ([n,t]) Too bad about NUglify. It produced a 37K minified file. 3 out of 4 failed. :sigh:

      Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #3

      So you have about (46K-37K)/2 times something like ...map(([n,t])=>.... ? :)

      It does not solve my Problem, but it answers my question

      M 1 Reply Last reply
      0
      • T Tim Carmichael

        Having never heard of a 'minifer', I followed the link that you said worked; OK, I understand what they are now. The next question is: does the page/site load noticeably faster when using the 'minifer'ed version? If so, what percent increase was seen?

        M Offline
        M Offline
        Marc Clifton
        wrote on last edited by
        #4

        Tim Carmichael wrote:

        The next question is: does the page/site load noticeably faster when using the 'minifer'ed version?

        Yes -- keep in mind not everyone is on highspeed internet, so minifying the javascript your website references can result in a 50% speed improvement on loading. Potentially more if you're on a satellite connection where the round trip ACK for each TCP/IP packet (typical [MTU](https://stackoverflow.com/questions/2613734/maximum-packet-size-for-a-tcp-connection) of 1500 bytes) can be time consuming, though having simulated such stuff, I would imagine that a satellite "router" attempts to deal with this by not using TCP/IP directly over the satellite, where every 1500 byte packet requires an ACK. Basically, minifying Javascript is a quite simple method of improving website performance regardless of the connection quality. It also makes the javascript harder to read by would-be hackers or the just plain curious. Obviously one wouldn't do this during development!

        Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

        T R 2 Replies Last reply
        0
        • L Lost User

          So you have about (46K-37K)/2 times something like ...map(([n,t])=>.... ? :)

          It does not solve my Problem, but it answers my question

          M Offline
          M Offline
          Marc Clifton
          wrote on last edited by
          #5

          0x01AA wrote:

          So you have about (46K-37K)/2 times something like

          It did make me wonder, but no, I don't. :laugh:

          Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

          1 Reply Last reply
          0
          • M Marc Clifton

            So I just tried 4 minifiers. Here are the results: [https://javascript-minifier.com/\](https://javascript-minifier.com/) Fails on class Helpers { [https://jscompress.com/\](https://jscompress.com/) Fails on class Helpers { [https://www.minifier.org/\](https://www.minifier.org/) Worked!!! Input was 81K, minimized is 46K. NUglify: [https://github.com/xoofx/NUglify\](https://github.com/xoofx/NUglify) Fails. Produced: Object.entries(t).map([n,t]=>i.setAttributeNS(null,n,t)) Note [n,t] needs to be ([n,t]) Too bad about NUglify. It produced a 37K minified file. 3 out of 4 failed. :sigh:

            Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

            Z Offline
            Z Offline
            ZurdoDev
            wrote on last edited by
            #6

            Weird. I believe we use the Microsoft one and it runs post build. Never had a problem with it and have been using it for 8 years.

            Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

            1 Reply Last reply
            0
            • M Marc Clifton

              Tim Carmichael wrote:

              The next question is: does the page/site load noticeably faster when using the 'minifer'ed version?

              Yes -- keep in mind not everyone is on highspeed internet, so minifying the javascript your website references can result in a 50% speed improvement on loading. Potentially more if you're on a satellite connection where the round trip ACK for each TCP/IP packet (typical [MTU](https://stackoverflow.com/questions/2613734/maximum-packet-size-for-a-tcp-connection) of 1500 bytes) can be time consuming, though having simulated such stuff, I would imagine that a satellite "router" attempts to deal with this by not using TCP/IP directly over the satellite, where every 1500 byte packet requires an ACK. Basically, minifying Javascript is a quite simple method of improving website performance regardless of the connection quality. It also makes the javascript harder to read by would-be hackers or the just plain curious. Obviously one wouldn't do this during development!

              Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

              T Offline
              T Offline
              Tim Carmichael
              wrote on last edited by
              #7

              Thank you; I can see where it would be beneficial. I've largely spent my career in the local world and largely avoiding web development. Now, if there was some way to compile it... but that is a whole other barrel of fish.

              D 1 Reply Last reply
              0
              • M Marc Clifton

                Tim Carmichael wrote:

                The next question is: does the page/site load noticeably faster when using the 'minifer'ed version?

                Yes -- keep in mind not everyone is on highspeed internet, so minifying the javascript your website references can result in a 50% speed improvement on loading. Potentially more if you're on a satellite connection where the round trip ACK for each TCP/IP packet (typical [MTU](https://stackoverflow.com/questions/2613734/maximum-packet-size-for-a-tcp-connection) of 1500 bytes) can be time consuming, though having simulated such stuff, I would imagine that a satellite "router" attempts to deal with this by not using TCP/IP directly over the satellite, where every 1500 byte packet requires an ACK. Basically, minifying Javascript is a quite simple method of improving website performance regardless of the connection quality. It also makes the javascript harder to read by would-be hackers or the just plain curious. Obviously one wouldn't do this during development!

                Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                R Offline
                R Offline
                RJOberg
                wrote on last edited by
                #8

                Marc Clifton wrote:

                It also makes the javascript harder to read by would-be hackers or the just plain curious.

                Not so much anymore, Chrome has the ability to pretty print JavaScript and CSS now. Plus unminifier tools are freely available out there too. Accidentally minified my source JS file once... yay for unminifiers.

                1 Reply Last reply
                0
                • T Tim Carmichael

                  Thank you; I can see where it would be beneficial. I've largely spent my career in the local world and largely avoiding web development. Now, if there was some way to compile it... but that is a whole other barrel of fish.

                  D Offline
                  D Offline
                  dandy72
                  wrote on last edited by
                  #9

                  Tim Carmichael wrote:

                  if there was some way to compile it...

                  Isn't that what WebAssembly is all about? (and now, being aware of that name's existence, you know as much about WebAssembly as I do)

                  N 1 Reply Last reply
                  0
                  • M Marc Clifton

                    So I just tried 4 minifiers. Here are the results: [https://javascript-minifier.com/\](https://javascript-minifier.com/) Fails on class Helpers { [https://jscompress.com/\](https://jscompress.com/) Fails on class Helpers { [https://www.minifier.org/\](https://www.minifier.org/) Worked!!! Input was 81K, minimized is 46K. NUglify: [https://github.com/xoofx/NUglify\](https://github.com/xoofx/NUglify) Fails. Produced: Object.entries(t).map([n,t]=>i.setAttributeNS(null,n,t)) Note [n,t] needs to be ([n,t]) Too bad about NUglify. It produced a 37K minified file. 3 out of 4 failed. :sigh:

                    Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                    Sander RosselS Offline
                    Sander RosselS Offline
                    Sander Rossel
                    wrote on last edited by
                    #10

                    That's why I write my code uglified and minified to begin with ;p

                    Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                    N 1 Reply Last reply
                    0
                    • D dandy72

                      Tim Carmichael wrote:

                      if there was some way to compile it...

                      Isn't that what WebAssembly is all about? (and now, being aware of that name's existence, you know as much about WebAssembly as I do)

                      N Offline
                      N Offline
                      Nathan Minier
                      wrote on last edited by
                      #11

                      Yes, that is exactly what WASM is all about. MDN has done its usual due diligence and added several sections about it: [WebAssembly | MDN](https://developer.mozilla.org/en-US/docs/WebAssembly)

                      "There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli

                      1 Reply Last reply
                      0
                      • Sander RosselS Sander Rossel

                        That's why I write my code uglified and minified to begin with ;p

                        Best, Sander Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly

                        N Offline
                        N Offline
                        Nathan Minier
                        wrote on last edited by
                        #12

                        Plus it's fun to watch co-worker eyes cross, I imagine.

                        "There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli

                        1 Reply Last reply
                        0
                        • T Tim Carmichael

                          Having never heard of a 'minifer', I followed the link that you said worked; OK, I understand what they are now. The next question is: does the page/site load noticeably faster when using the 'minifer'ed version? If so, what percent increase was seen?

                          G Offline
                          G Offline
                          grumpy_nl
                          wrote on last edited by
                          #13

                          2Ahosting in combi with cloudflare will minifie your scripts by default

                          1 Reply Last reply
                          0
                          • M Marc Clifton

                            So I just tried 4 minifiers. Here are the results: [https://javascript-minifier.com/\](https://javascript-minifier.com/) Fails on class Helpers { [https://jscompress.com/\](https://jscompress.com/) Fails on class Helpers { [https://www.minifier.org/\](https://www.minifier.org/) Worked!!! Input was 81K, minimized is 46K. NUglify: [https://github.com/xoofx/NUglify\](https://github.com/xoofx/NUglify) Fails. Produced: Object.entries(t).map([n,t]=>i.setAttributeNS(null,n,t)) Note [n,t] needs to be ([n,t]) Too bad about NUglify. It produced a 37K minified file. 3 out of 4 failed. :sigh:

                            Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #14

                            What is the actual size being transmitted? Since web traffic is / can be compressed by default, is it worth doing "minify" explicitly? (i.e. is it redundant when considering compression).

                            "(I) am amazed to see myself here rather than there ... now rather than then". ― Blaise Pascal

                            M 1 Reply Last reply
                            0
                            • L Lost User

                              What is the actual size being transmitted? Since web traffic is / can be compressed by default, is it worth doing "minify" explicitly? (i.e. is it redundant when considering compression).

                              "(I) am amazed to see myself here rather than there ... now rather than then". ― Blaise Pascal

                              M Offline
                              M Offline
                              Marc Clifton
                              wrote on last edited by
                              #15

                              Zipping the raw js vs. the minified js resulted in 17K and 9K respectively, so even if the web traffic is compressed, it's still ~50% reduction. At least, in my one little test!

                              Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                              L 1 Reply Last reply
                              0
                              • M Marc Clifton

                                Zipping the raw js vs. the minified js resulted in 17K and 9K respectively, so even if the web traffic is compressed, it's still ~50% reduction. At least, in my one little test!

                                Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #16

                                Nice. Thanks for the info (and your testing)!

                                "(I) am amazed to see myself here rather than there ... now rather than then". ― Blaise Pascal

                                1 Reply Last reply
                                0
                                • M Marc Clifton

                                  So I just tried 4 minifiers. Here are the results: [https://javascript-minifier.com/\](https://javascript-minifier.com/) Fails on class Helpers { [https://jscompress.com/\](https://jscompress.com/) Fails on class Helpers { [https://www.minifier.org/\](https://www.minifier.org/) Worked!!! Input was 81K, minimized is 46K. NUglify: [https://github.com/xoofx/NUglify\](https://github.com/xoofx/NUglify) Fails. Produced: Object.entries(t).map([n,t]=>i.setAttributeNS(null,n,t)) Note [n,t] needs to be ([n,t]) Too bad about NUglify. It produced a 37K minified file. 3 out of 4 failed. :sigh:

                                  Latest Article - Contextual Data Explorer Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                                  T Offline
                                  T Offline
                                  thewazz
                                  wrote on last edited by
                                  #17

                                  i've used this no-name compressor: JSCompressor[^]. i think it's pretty old and i don't have complex js. i don't know how it will work with modern/latest js.

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups