Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any Java CSS formatter util? [closed]

I need to format (not compress) CSS code, so that unreadable CSS code is formatted to be readable. I need this as Java library.

like image 221
newbie Avatar asked Mar 31 '26 21:03

newbie


1 Answers

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.

like image 52
Paul Grime Avatar answered Apr 03 '26 11:04

Paul Grime



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!