CSS minifier
CSS minifiers are tools that take raw CSS code and compress it by removing unnecessary characters and white spaces. The goal of minifying CSS is to reduce the file size and improve load times of web pages.
Minified CSS code has the following characteristics:
• No comments: All CSS comments are removed. Comments are ignored by the browser and only add to the file size.
• No indentation: All indentation spaces and line breaks are removed. The CSS rules are compacted into a single line.
• Shortened color values: If a color can be represented in a shorter format, it is converted. For example, #FFFFFF is converted to #FFF.
• Removed unneeded white space: All extra spaces, tabs, and line breaks are removed. There are no spaces between CSS rules, selectors, and style rules.
• Merged selectors: Where possible, selectors are merged to further minimize the code. For example, .header .title h1 and .header h1.title are merged to .header h1.title.
• Shortened numeric values: Values like 0.5em are converted to .5em and 0px is converted to 0.
• Removed empty rules: Any CSS rules that contain no properties are removed.
• Converted shorthand where possible: Shorthand CSS properties are used whenever possible to replace individual properties. For example, padding: 10px 20px 10px 20px is converted to padding: 10px 20px.
Minified CSS is not intended to be read by humans. It is optimized for performance and file size. The CSS minifiers simply automate the compression process to speed up page loads and reduce bandwidth usage.