Today, many visual effects and other codes are created with JavaScript, and allow us to make the blog much more impressive and elegant, like JQuery libraries.
The big problem that brings us the use of javascript files is slow in loading the blog. We saw that Google takes into account the velocity at blog, And also mentioned on other occasions, that if the reader gets tired of waiting, complete closing our blog.
Tips to reduce the use of Javascript files
- Use the least amount of javascript files,
- The javascript code if possible should be outside the html file, ie in separate files, and be called from the html file.
- Avoid unnecessary use of characters or line breaks and spaces, to optimize this reduces the file size.
- Using tools that compress the files as code Javascript Compressor or Google tool Closure Compiler.
Compressing javascript code will achieve a load much faster, without losing the effects of the file.
In previous articles we saw also compress CSS files, To further accelerate the loading of the blog yet. Not only search engines will thank us, but so will visitors.