This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # admin-announcements (56)
- # beginners (67)
- # boot (159)
- # cider (5)
- # cljs-dev (16)
- # cljsjs (7)
- # clojure (142)
- # clojure-dev (15)
- # clojure-japan (1)
- # clojure-poland (1)
- # clojure-russia (33)
- # clojurebridge (2)
- # clojurecup (1)
- # clojurescript (56)
- # cursive (3)
- # datavis (2)
- # datomic (29)
- # devops (6)
- # editors (1)
- # emacs (3)
- # hoplon (95)
- # ldnclj (15)
- # leiningen (18)
- # off-topic (10)
- # om (12)
- # onyx (7)
- # parinfer (6)
- # proton (1)
- # spacemacs (3)
- # yada (2)
if I right hiccup has no template inheritance. How can I make it work thatI made one template for several pages ? or can I better use selmer ?
If I can better use selmer. How must I translate this : '
i've never seen anyone offended before for saying "hey guys." where I was raised and where I'm living now, it's inclusive of anyone male/female whatever. just a colloquial that everyone is used to. i know as programmers we are pretty pedantic but shouldn't make anyone feel bad for speaking the way they're used to talking
@roelof: Hiccup is dealing with HTML as a data structure. So if you want to have a "template", in Hiccup that would be a function that returns a data structure that is partially the same no matter what you pass it, and partially depends on what you pass it. So, like, if your template is all the header and footer stuff, and you want to put some content within that template, write a function that accepts that content (as a Hiccup data structure) as the argument and returns the data for the whole page. It's just data structures, so it should be easy.
Let's say I have a home page and a contact page which shares the same header and footer
@roelof: Something like this:
You'd have to fill out the details of the header and footer. But then you could say e.g.:
(defn content->page [content] [:html [:head ...] [:body [:div.content content] [:div.footer ...]]])
…to get a full page with that content. Make sense?
(content->page [:p "Hello world!"])
Yeah, basically in hiccup template inheritance can be done with language mechanisms - function composition and higher order functions.
oke, so I can make functions for all and when I want to use them I could make a function call with the right parameters
I hope I can make then a template like this page that way : https://laboutique.lemonstand.com/
I don't think hiccup cares about that, but resources/ is the standard place to put them.
and do I understand it right I have to do all the templating of all the pages in one file
Right. You can have a different function for the header content, for example. Or you could have multiple different templates. Or whatever you want. It's just data.
Also, you don't have to put hiccup templates in resource directory, you can have them in the same source directory the rest of code, since it's code like any other.
I usually keep my hiccup in the source directory under some namespace like
project-name.templates.page-name or something.
Yes, good point @jaen. To clarify, I think
resources/ is a good place to put CSS and JS files, but I probably wouldn't put any Clojure functions (like my
content->page example above) in
resources/. Code goes in
oke, and I found here a example of what you are trying to tell me : https://github.com/yokolet/hiccup-samples/blob/master/src/
Yup, that looks pretty sensible to me, though I usually wrap each function-template with the` html` macro, not just the top level one, but I'm unsure if that's wrong or right - that's just what I do.
The difference would be I would be doing
(def template  (hiccup/html5 [:div "some hiccup"]))
in each template.
(def template  [:div "some hiccup"])
last question I hope. How do I translate this ` <meta charset="UTF-8"> <meta name="Description" content=""/>`
@bhauman: devcards is pretty awesome 😉 just wondering if you knew how to get some jquery library initializing from the dom to play nicely with reagent
@naomarik: that's more of a React thing. Read up on how to create react components and the lifecycle https://facebook.github.io/react/docs/component-specs.html