For example
input{margin:0}body{margin:0;background:white}
would be shorter written like this
input,body{margin:0}body{back
try LESS.
LESS will automatically recognizes when you save your *.less
file and immediately compiles your CSS-Code and will minified. You can create as many files as you want and LESS will observe them all to trigger compilation.
You will only work in the .less
files. the Tool will auto compile and save you files as .css
http://lesscss.org/
May be the wrong thing, but http://www.cleancss.com/?
Ther are several out there. Some of the best ones are;
http://refresh-sf.com/yui/
http://www.minifycss.com/css-compressor/
The second one groups rules that match together also and more.
I would recommend https://www.npmjs.com/package/gulp-clean-css
if you don't have problems using gulp it's doing exactly as you want
CSSO is little bit outdated, ACCSS is a port CSSO to but fixes open issues of the original code.
https://github.com/acwtools/accss
and it also has a better compression ratio
have you tried less.js ? you can write css code in an object oriented manner, also you can use this framework either on client side or server side, below a demonstration on your case:
/* you can write you desired css as follows */
body {
&input {
margin: 0;
}
background:white;
}
and it will be automatically compiled into:
body, input {
margin:0;
}
body {
background:white;
}