leptos icon indicating copy to clipboard operation
leptos copied to clipboard

source html in production

Open MrChaker opened this issue 1 year ago • 5 comments

In the final html result ( checked using dev tools sources ) , Is there any way that I can make the content inside the body to be formatted instead of just being 1 line

For example:

leptos = { version = "0.4", features = ["nightly"] }
leptos_axum = { version = "0.4", optional = true }
leptos_meta = { version = "0.4", features = ["nightly"] }
leptos_router = { version = "0.4", features = ["nightly"] }

MrChaker avatar Jan 23 '24 10:01 MrChaker

Could you elaborate a bit more?

Are you looking to format the HTML sent to the browser?

rakshith-ravi avatar Jan 23 '24 10:01 rakshith-ravi

@rakshith-ravi yes , here's what I got ... Screenshot 2024-01-21 at 9 57 49 PM Body is 1 line ...

MrChaker avatar Jan 23 '24 10:01 MrChaker

Not sure if this is a browser problem or with leptos

MrChaker avatar Jan 23 '24 10:01 MrChaker

This is a very common industry practice to minify HTML to reduce the amount of data transferred over the wire. That being said, if you go to inspect element, your browser should show you a parsed version that you can fiddle around with.

Additionally, most browsers have a "pretty format" (or something along those lines) button that pretty-prints it for you.

What is your use-case for having a formatted HTML though, out of curiosity?

rakshith-ravi avatar Jan 23 '24 11:01 rakshith-ravi

I'm going to treat this one as a feature request to pretty-print HTML in debug mode. I can see the use case for this, as I sometimes use View Source to check the original HTML in case there are discrepancies relative to the DOM inspector (this happens with things like multiple <body> tags, etc.). But it's not something I'm going to put time into myself. Someone else is welcome to if they'd like!

gbj avatar Jan 29 '24 14:01 gbj