GithubHelp home page GithubHelp logo

Unminified output about hiccup HOT 10 OPEN

 avatar commented on July 25, 2024 2
Unminified output

from hiccup.

Comments (10)

weavejester avatar weavejester commented on July 25, 2024

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.

from hiccup.

 avatar commented on July 25, 2024

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.

from hiccup.

weavejester avatar weavejester commented on July 25, 2024

Can't newline characters with correct indentation be added for making the initial HTML document readable?

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.

from hiccup.

drusellers avatar drusellers commented on July 25, 2024

👍

from hiccup.

dwhite44 avatar dwhite44 commented on July 25, 2024

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

from hiccup.

mgerlach-klick avatar mgerlach-klick commented on July 25, 2024

I wrote this library to deal with this: https://github.com/px0/clj-beautify-web
I usually put something like this in the render chain after the html macro:

(fn [html]
    (if (= "production" (:environment render-params))
    html
    (beautify-web.core/beautify-html html)))

from hiccup.

didibus avatar didibus commented on July 25, 2024

Is this planned for 2.0 ?

from hiccup.

weavejester avatar weavejester commented on July 25, 2024

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.

from hiccup.

didibus avatar didibus commented on July 25, 2024

Ah I see. Okay, thank you, I'll look into beautify-html for my debugging purpose.

from hiccup.

metametadata avatar metametadata commented on July 25, 2024

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 "  "))))

from hiccup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.