HTML5 Zone is brought to you in partnership with:

Paulund is a website dedicated to writing tutorials and code snippets about Web Development, the main subjects are PHP, Wordpress, jQuery, CSS3 and HTML5. Paul is a DZone MVB and is not an employee of DZone and has posted 124 posts at DZone. You can read more from them at their website. View Full User Profile

CSS Beautifier

04.27.2013
| 3217 views |
  • submit to reddit

 

CSS Beautifier

When you developing CSS for your website you will normally create your CSS in a way that makes it easier to read. This means each property will be on it's own line, you will have line breaks in-between classes and id's, you should even have comments between different sections of your styles.

This is great for developing as it keeps your styles organised, makes it easy for you to find styles, and has comments to explain what the styles are going to do. But the problem with this is that it will increase the size of the CSS file, when you use this on your website in a production environment it's important that your website loads fast. A good way of helping your website load faster is to minimize your CSS and Javascript files, this is because it will reduce the bandwidth needed for the file and will speed up your site.

It's easy to minimize your files you can either use a script to do this or make your IDE minimize your files.

But if all you have is the minimized file and you want to make some changes to this file it can be really hard to work out where your styles are, you need to un-minimize the file so you can see the styles in a readable way.

Here is a tool called CSS Beautifier which will allow you to enter minimized CSS and it will convert this into readable CSS for you. So if you only have the minimized file you can copy this into the tool and it will convert the entire contents to readable CSS.

Try it out.

CSS Beautifier

Published at DZone with permission of Paul Underwood, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)