auhtor_image
Volodymyr Terebus

Front End Development Practice Lead

Web Project Optimization

In order to minimalize the amount of time needed for loading and rendering content, all applications should request required content in a timely fashion, whether it be at the users demand or in the event it be prefetched before. Please ensure applications use local copies of content if necessary and create http request models as small as possible.

It is noted that it is compulsory for all browsers and servers to use http compression, and browser is also using  cache mechanism. Securing that our server delivers a response as rapidly as possible with a size as small as possible will consequently assist us to reach our end goal more promptly.

Optimizing JavaScript

When optimizing JavaScript, please remove all unused JavaScript dependencies, methods, and files, all manually.  Ensure any unnecessary dependencies are completely discarded in the case of an event where a smaller alternative file exists or if you find your code only uses a couple different methods, you can easily write it in manually. Treeshaking is a term you may be familiar with. Treeshaking is when you use tools to remove unused parts of code and is essential to know when optimizing JavaScript. The Webpack and Rollup features are also helpful when removing parts for code. Use any minimizing tools you may need while working, such as UglifyJS, Minify, etc.

Optimizing Cascading Style Sheets and HTML Content

As you optimize Cascading Style Sheets, do as we had done with JavaScript and completely remove all unused CSS dependencies and parts manually. Please do not use the full CSS framework if you only need a few parts from it. Feel free to use any minimization tools as needed, such as Minify, Clean-CSS, or CSS.

Just as we did with JavaScript and Cascading Style Sheets, while optimizing HTML content, please ensure all unused HTML parts of mark ups are completely removed manually and use any minimization tools that are necessary, such as HTML-minifier.

Media Content Optimizations

When optimizing images, audio, and video content, please make certain that unused media contents and/or references to those contents are removed in order to build the application. Use any Lossless/Lossy images, audio, and/or video compression tools, such as, pngquant, etc. Please do not use separate content files to optimize their quantity and boost delivery. Instead, focus on using image, audio, and/or video sprite sheets or atlases.

This is great practice to use Lossy as an audio format instead of WAV or any other uncompressed formats and a great practice if you’re not already familiar with PNG format. When you are not using PNG, practicing with SVG icons is necessary. For a set of SVG files, it is essential to create custom font and SVG sprite to boost delivery.

Optimizing HTTP Content Delivery

While optimizing HTTP content delivery, minimize the count of delivery files. All files can be placed in HTML, JS, or CSS files in Base64 format, however, it will increase the size of the content. All text based files can easily be placed in HTML/JS/CSS without any fine. This will make it easily accessible to create one file with all of our contents if it was ever necessary.

As you optimize the HTTP request and response data, confirm HTTP compression is turned on and replace the JSON/text request/response data to a tighter format. Use a binary data model instead of JSON, CSV, etc. Or attempt to minimize the scheme size in JSON. Please ensure you don’t fetch or push already fetched or pushed data as you are optimizing this. For example, a first -time client fetch full and big array of orders. The second time when you want to synchronize your list you should fetch only changes.

Final Recommendations

Make sure you never load the same content twice. Ensuring you use cache mechanisms, storing synchronization by yourself, and using service workers to implement fitness synchronization behavior of content delivery can prevent this from ever happening.

It’s acceptable to preload some content, and use ‘async’ and ‘defer’ attributes to prevent block loading HTML. It is asked you do not load an entire project if you only need one part.