Search code examples
javascriptoptimizationminify

optimized/minifed javascript code but still readable/maintainable


I'm a beginner at javascript and learn a lot by looking already written code.

Some large javascript projects I've looked at have minified code and when expanding it it's not very readable.

almost all variables and functions are just defined by a letter looping trough the alphabet i.e a b c, aa, bb, cc and so on, also no commenting.

Out of curiosity is this a coding style or is there a tool that you use to optimize the code with?

seems hard to maintain such a project.


Solution

  • No, it's not a coding style (except if you're doing code-golfing manually for fun).

    You take the unminified code and squeeze it through a tool such as https://github.com/terser/terser (which is probably the most popular at the time of writing).

    You can see what Terser does online with their Try Terser tool. https://try.terser.org/