1. Getting Started
  2. Installation: Preline UI

Code

Minify JavaScript

Unminified JavaScript is the script in its original state, correctly indented, human-readable, and maintainable.

You can reduce the size of the script files through minification.

Using this method reduces bandwidth usage and speeds up page load times.

Why it is important

Developers create JavaScript files using comments, white space, and coherent variable names.

In this way, they make code and markup more readable for themselves and others who might work on them later.

However, when it comes to serving your pages, their coding techniques cause extra network traffic without providing any functional benefit.

Using a minified file version provides the same functionality but reduces network bandwidth usage.

How the audit fails

Sitefig uses the Lighthouse tool, which estimates minification savings by determining the ratio of parseable JS tokens to the length of the entire string.

Though simple, this method accurately identifies whether a script was already minified and offers a relatively conservative minification estimate.

This audit only examines scripts that were independent network requests and not inlined, or eval'd.

See unminified-javascript for stats on accuracy.

Fixing the problem

To minify JavaScript, you can try different tools, for example: UglifyJS, Closure Compiler.

You can create a build process that uses these tools to minify and rename the development files and save them to a production directory.

To minimize code and reduce file size, developers could also remove comments and extra space.

All rights reserved - Sitefig