Website Care, Performance & Security

Minification

Minification reduces the size of source files such as CSS and JavaScript by removing or shortening content that is unnecessary for the browser to process them.

Developers write code with whitespace, comments and meaningful variable names because they make maintenance easier. A build tool can produce smaller production assets by removing safe whitespace and comments, shortening eligible identifiers and simplifying syntax. The resulting file is harder for humans to read but should behave the same as the original. Minification is usually part of a larger production build rather than a manual edit to a site's source files.

Smaller assets can reduce transfer time, especially on slower connections, but minification is not the same as compression. Gzip or Brotli compress files during delivery, while minification changes the delivered source text. Tree shaking removes unused code where the build tooling can prove it unnecessary; that can be related to minification but is a separate optimization. Images require different techniques.

Test the resulting bundle with the actual site, keep source maps private or appropriately controlled if needed for debugging, and check license requirements for retained notices. A minifier can expose unsafe assumptions in poorly written scripts. Do not promise that minifying alone will solve slow rendering, excessive third-party code or large media assets. Measure the network and runtime impact before claiming a performance win.