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

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...

Worm Manure (Vermicompost) – 2020

Worm manure production can be initiated with large-scale commercial thinking, as well as the increasing number of red...

Seo FAQ – Best Tips 2020

What kind of website does Google ask us to make? What are the points to be considered when...

Related Stories

Your feedback is valuable to us

MediaZone - Ge the daily news in your inbox