Minify Javascript

Minify Javascript Solution

What it is:With the increase in the use of Ajax and Javascript libraries on the websites, the loading time of the pages increases considerably. For a 25-30 kb HTML file, 80-90 kb Javascript and CSS file are used.
Solution:We can reduce file sizes by clearing the spaces and comments in our Css and Javascript files.
Expert Comment:It should be done even if it does create some difficulty in the development period.

General Explanation

The “Minifying” code means eliminating unnecessary bytes. Examples include extra spaces, line breaks, and indentation. Keeping the JavaScript code tight has some advantages. It is possible to mention that the smaller file size for inline JavaScript and external files that are not cached reduces the network latency that occurs each time a page is downloaded. Secondly, compression of external JS files and HTML files with JS code inline may increase even more. Thirdly, smaller files can be loaded and run faster by web browsers.

Various tools can be used to minimize JavaScript, including Shutdown Compiler, JS Min or YUI compressor. A build program can be created that uses these tools to shrink and rename progress files and save them to a production directory. We recommend to shrink JS files that are 4096 bytes or larger. You should see a benefit for any file that can be reduced by 25 bytes or more. (Less than this does not result in any noticeable performance gains.)

JavaScript Recommendations

You should shrink your HTML, CSS and JavaScript resources:

  • Try the HTML Minifier to minimize the HTML.
  • Try CSSNano and csso to minimize CSS.
  • Try UglifyJS to minimize JavaScript. Closing Compiler is also very effective. You can create a rendering process that uses these tools to shrink and rename development files and save them to a production directory.

Alternatively, the PageSpeed Module integrates with an Apache or Nginx web server to automatically optimize your site, including resource minification.

Making JavaScript and CSS External

Because JavaScript and CSS files are cached by the browser, using external files in the real world often results in faster pages creation. Inline JavaScript and CSS in HTML documents are downloaded whenever the HTML document is requested. Although this reduces the number of HTTP requests required, it causes an increase in the size of the HTML document. On the other hand, the external document cached by the JavaScript and CSS browser reduces the size of the HTML document without increasing the number of HTML requests.

Page Speed Terms and Solutions

Recent Articles

Exhaust Gases Are Harmful To The Heart

According to research, air pollution due to traffic is very harmful to the heart and lungs. Those living in areas close to...

Domain and Corona Virus

Hello GuysAfter the coronavirus started, many domain investors started registering domains related to corona.According...

Superconductors and Superconductor Physics 2020

You plug the cable into the wall socket and run the device by passing the electric current through...

How to Write SEO-Friendly Articles 2020

What is an SEO Friendly ArticleIt draws an increasing graph in the right proportion...

New Release of The Witcher 3 Redux – Free Download

A new version of The Witcher 3 Redux Mod has been released by a modder. The new version...

Related Stories

Your feedback is valuable to us

MediaZone - Ge the daily news in your inbox