-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unminified output #65
Comments
Not with the current version (because it outputs directly to a string). However, most (all?) modern browsers allow you to look at the DOM of the page. Viewing the raw source usually isn't necessary. |
Can't newline characters with correct indentation be added for making the initial HTML document readable? When using a framework it adds a lot of custom elements/attributes making debugging harder if we are depending on the web inspector. |
No, because it outputs directly to strings. In order to produce correct indentation you need the whole DOM, which is planned for version 2.0. |
👍 |
It would definitely be nice to have some minify options with hiccup. I don't necessarily need unminified but I would like an option to have a space between each element to help with spacing problems that can result from having no whitespace between elements such as this bootstrap issue: twbs/bootstrap#14401 |
I wrote this library to deal with this: https://github.com/px0/clj-beautify-web (fn [html]
(if (= "production" (:environment render-params))
html
(beautify-web.core/beautify-html html))) |
Is this planned for 2.0 ? |
No, plans for 2.0 were scaled back. Adding it in for 2.1 is a possibility, but I haven't had much time to work on Hiccup recently. |
Ah I see. Okay, thank you, I'll look into beautify-html for my debugging purpose. |
I'm also interested in such a built-in feature as I find readable formatting more convenient for unit tests and sometimes look at the source code instead of a browser inspector. The current workaround is to use Jericho to postformat the generated HTML: [net.htmlparser.jericho/jericho-html "3.4"]
...
(:import [net.htmlparser.jericho Source])
...
(defn formatted-html
[s]
(str (-> (.getSourceFormatter (Source. s))
(.setIndentString " ")))) |
Is there a way making hiccup generate unminified output so it would be easier to debug in the browser?
The text was updated successfully, but these errors were encountered: