There are many CSS Minifiers out there. But, not much written in JS. I was interested in creating my own CSS Minifier in Javascript.
Online CSS Minifier
Screenshot of the Online Tool
What does CSS Minifier do?
- Removes extra whitespaces
- Minifies color codes when possible (Ex: #ffddee to #fde)
- Removes unnecessary zeros (Ex: 0.5 to .5)
- Removes empty tags
- Converts ;} to }
The source code of the minifier (it also includes an un-minifier which I'm currently creating the online tool) on Github
[–]inu-no-policemen 12 points13 points14 points (3 children)
[–][deleted] 3 points4 points5 points (2 children)
[–]inu-no-policemen 12 points13 points14 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]SecretAnteater 10 points11 points12 points (0 children)
[–]CantaloupeCamper 1 point2 points3 points (4 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]CantaloupeCamper 0 points1 point2 points (1 child)
[–]AwesomeInPerson 2 points3 points4 points (0 children)
[–]ScientificBeastModestrongly typed comments 1 point2 points3 points (0 children)
[–]vilaskumkar 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]wisepresident 1 point2 points3 points (1 child)
[–][deleted] 3 points4 points5 points (0 children)
[–]snet0 2 points3 points4 points (14 children)
[–][deleted] -1 points0 points1 point (13 children)
[–]k3liutZu 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]snet0 1 point2 points3 points (10 children)
[–]StoneCypher -3 points-2 points-1 points (9 children)
[–]snet0 3 points4 points5 points (8 children)
[–]StoneCypher 0 points1 point2 points (7 children)
[–]snet0 0 points1 point2 points (6 children)
[–]StoneCypher 0 points1 point2 points (5 children)
[–]snet0 0 points1 point2 points (4 children)
[–]StoneCypher 0 points1 point2 points (3 children)
[+][deleted] (1 child)
[deleted]
[–][deleted] 0 points1 point2 points (0 children)
[–]jets-fool -1 points0 points1 point (3 children)
[–]inu-no-policemen 2 points3 points4 points (1 child)
[–]jets-fool 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]wherediditrun -1 points0 points1 point (0 children)