Cascading Style Sheets or CSS Files are used to describe how a browser should display the visual elements of a webpage.
CSS files are particularly useful for websites that use templates & themes, as they can be applied to a variety of pages at once.
Similarly, entire websites can be styled using only 1-2 sheets in some instances.
Optimizing CSS Files Using Code Grouping & Minification
When a webpage uses a CSS file, the file is called from the HTML code in the page’s source.
The browser then requests the files from the server where they are stored.
Many CSS files can be grouped together to reduce the total number of requests between the client & server without causing problems for the way the page renders & interacts.
Once the file is transferred tot he browser, the browser needs to parse it to know what it says.
Code minification accomplishes this, as when code is minified it is streamlined to remove all of the whitespace found between lines etc… that are not needed.
When done correctly, the files load the same way they would before being minified, but take less time to parse.
This can be particularly beneficial for files that cannot be grouped or compressed much further, or for when grouping files so that the grouped file can be parsed even faster, additionally boosting speed.