Jump to content

Is there a way to beautify CSS stylesheet content with javascript? human readable format?


pstein

Recommended Posts

  1. Assume I have a CSS stylesheet link similar to
    http://www.foobar.com/aaa/bbb/ccc.css
    Now I want to show the content (=CSS rules) of this stylesheet in (Firefox) browser.
    Unfortunately the css file content is compressed resp. written in one long line.
    Is there a way to beautifiy the css content to a more human readable format with javascript code?

    Peter
Link to comment
Share on other sites

If it's your own stylesheet, you should have the uncompressed version as well. You can show that one instead. If it's not yours, it is possible to improve the formatting using string manipulation in any programming language. That is something I'd recommend doing on the server-side instead of with Javascript. Somebody has already built such a program and you can see it here: https://www.cleancss.com/css-beautify/

There probably is a github project with the source code to do that, try searching around.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...