Is there any Java CSS formatter util? [closed]
I need to format (not compress) CSS code, so that unreadable C开发者_如何转开发SS code is formatted to be readable. I need this as Java library.
I just tried using the beautifier from http://jsbeautifier.org/ in Rhino.
I downloaded the JS from:
https://github.com/einars/js-beautify/blob/master/beautify.js
Then started Rhino (must be in Rhino installation directory):
java -jar js.jar -opt -1
Load beautify.js
(assuming you copied it to the Rhino installation folder, else use different file path):
load("beautify.js")
And then beautify beautify.js
itself!
js_beautify(readFile("beautify.js"))
This can also be embedded into your Java app. Give this answer a try.
精彩评论