Fork me on GitHub

Hi, it's me... I am back again.


@pupeno: your blog has been really useful to me, thanks very much - I've used bidi rather than silk (I'm a bit biased towards bidi) but that was easy because pushy explains exactly how to use either - nice article


and re-frame is really a great addition to reagent

Pablo Fernandez08:08:26

malcolmsparks: I’m glad. What are your reasons for bidi?

Pablo Fernandez08:08:49

malcolmsparks: my main reason for silk is that the author hangs out in slack and is accessible. simple_smile

Pablo Fernandez08:08:38

malcolmsparks: ah! simple_smile

Pablo Fernandez08:08:30

There goes the silk advantage. 😕

Pablo Fernandez08:08:50

Did you look at silk?


"Bidi is a fantastic library and was my favorite Clojure routing library prior to Silk. The design of Silk was heavily influenced by that of Bidi."


bidi came before silk, and if you look at the 2 code-bases they are very similar - the main rationale for silk was that it was to support cljs, but now bidi supports cljs too there's not so much difference


there are some slight differences in how the routing works - in particular bidi avoids dispatching on query parameters, because I'm still a bit of a purist at heart and that feels just wrong to me


I also want bidi to stay true to its (strict) REST routes, so it encourages hypermedia APIs (that's the whole point actually) and doesn't want to subvert REST by redefining what it means to be a resource


@pupeno: quick question, what's the main advantage to avoiding doc fragments? it seems nice to me, because it means you can decouple the structure of your single page apps from the routing


so if I want to break up a huge SPA into sub-apps, or recombine multiple apps into a single monolith, I can do that without breaking URIs - that seems a good advantage to me - but are there others?

Pablo Fernandez08:08:41

malcolmsparks: thanks for the answers, and what do you mean by doc fragments?


sorry, I meant # in the uris


fragment is the bit after the #


your URIs are fragment-less


is HTML5 push-state the magic there? and is it supported by lots of browsers now?

Pablo Fernandez08:08:40

I am also a purist and I don’t thing fragments should be used to specify which page to show, only to scroll. Also, they are not send in HTTP requests (as far as I know), so the server can’t pre-render the appropriate page.

Pablo Fernandez08:08:17

I’m sure Google is not doing it anymore, but it wouldn’t be wrong to assume that /#/user/1 and /#/user/2 are the same page, from an indexing point of view, when the content is different.

Pablo Fernandez09:08:17

And yes, HTML5 allows you to handle the URL change events so that you can avoid hitting the server. It’s quite well supported:


ah, that's a good point, you're right


Google have a #! convention for that specific case


@thomas: Real programming! 😉


@jonpither: missed your previous comment (bad excuse but was on holidays), expez is working on a version of clean-ns on this branch: meanwhile remove-requires should work on cljc/cljs files too

Pablo Fernandez15:08:53

@malcolmsparks: in bidi, how do I match the empty route? I can match “/“ and “/about” with (def routes ["/" {"" :home-page "about" :about-page}]), but how do I match “”?

Pablo Fernandez15:08:33

This seems to work:

Pablo Fernandez15:08:34

(def routes ["" {""       :home-page
                 "/"      :home-page
                 "/about" :about-page}])


you can use boolean true as a pattern


`(def routes ["" {"" :home-page "/" :home-page "/about" :about-page}])`


(def routes ["" {"" :home-page "/" :home-page true :default-page}])