Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an app to automatically format CSS files?

Tags:

css

I have a compressed CSS file (all whitespace removed) that I want to inspect, but it's a huge pain inspecting it as-is. Is there any utility (preferably linux command line) that I can run the file through to format it nicely?

like image 429
Herms Avatar asked Jul 30 '10 13:07

Herms


People also ask

How do I beautify CSS?

This tool allows loading the CSS URL to beautify. Click on the URL button, Enter URL and Submit. Users can also format CSS File by uploading the file. Beautify CSS Online works well on Windows, MAC, Linux, Chrome, Firefox, Edge, and Safari.

How do I beautify CSS in Visual Studio?

press F1 or ctrl+shift+p and then enter beautify ..

How do I make a CSS code readable?

Information: Readable CSS You can add whitespace and comments to your stylesheets to make them more readable. You can also group selectors together, when the same style rules apply to elements selected in different ways.


3 Answers

The online service that Dave Newman mentioned has been converted into a Node.js script, which you can run on the command-line. If you have NPM installed you can just do:

npm install -g cssunminifier

And it’s pretty versatile how you can use it. Here are 3 different examples:

cssunminifier style.min.css style.css
cssunminifier --width=8 style.min.css
curl http://cdn.sstatic.net/stackoverflow/all.css | cssunminifier - | less

Here’s more info on the command-line css unminifier

like image 80
MrColes Avatar answered Nov 15 '22 11:11

MrColes


Try this online service.

You can also inspect any compressed file in Firebug.

like image 43
Daniel O'Hara Avatar answered Nov 15 '22 12:11

Daniel O'Hara


These programs are called 'beautifiers'. You should be able to google one that fits for you.

like image 30
relet Avatar answered Nov 15 '22 11:11

relet