make your CSS pretty

Downloads in past


1.0.09 years ago9 years agoMinified + gzip package size for beautify-css in KB


beautify-css is a command-line CSS beautifier that uses the css npm module to parse and format valid CSS.
You can install it with npm install [-g] beautify-css.


beautify-css [options] [input] [output]

  --indent, -i    indent with this number of spaces (or string)    
  --encoding, -e  string encoding (default: "utf8")                
  --compress, -c  compress output, removing whitespace and comments
  --source-map    generate a source map, and write it to this file 
  --source-in     reference one or more input source maps          
  --in-place, -p  modify the input file in place                   
  -v              output helpful debugging messages                

Some examples:
# read from and write to files
beautify-css ugly.css pretty.css

# or you can use the --in-place/-p to overwrite the file
# (remember to back it up or check it in first!)
beautify-css -p style.css

# read ugly css from stdin, write to a filename
echo 'body{margin:0}' | beautify-css - pretty.css
# or redirect stdout to a file
echo 'body{margin:0}' | beautify-css > pretty.css

# pipe pretty css to another tool, such as
# myth: <>
echo 'body{margin:0}' | beautify-css | myth > beautiful.css