开发者

Is there any Java CSS formatter util? [closed]

开发者 https://www.devze.com 2023-04-04 12:59 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 11 years ago.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号