CSS Minifer - Built with 8 lines of Javascript

Project URL: https://css-minifier.glitch.me

I recently built this with 8 lines of Javascript. Read about it here.

How do you use it? You enter raw CSS in the first box, and minified CSS comes out of the second box.

How does it work? This is the code, you can view it here:

var inputs = document.getElementsByTagName("textarea");
function minify() {
  inputs[1].value = inputs[0].value
    .replace(/(\W)\s+/g, "$1")
    .replace(/\s(\W+)/g, "$1")
    .replace(/;}/g, "}")
    .replace(/\/\*.*?\*\//g, "");

Read more about what this does here.

So what do you think? Any feedback is welcome.


This might come in handy!