Fork me on GitHub
#ldnclj
<
2015-08-19
>
thomas07:08:35

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

malcolmsparks08:08:01

@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

malcolmsparks08:08:32

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?

malcolmsparks08:08:11

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

malcolmsparks08:08:06

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

malcolmsparks08:08:16

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

malcolmsparks08:08:20

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

malcolmsparks08:08:12

@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

malcolmsparks08:08:47

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?

malcolmsparks08:08:55

sorry, I meant # in the uris

malcolmsparks08:08:02

fragment is the bit after the #

malcolmsparks08:08:08

your URIs are fragment-less

malcolmsparks08:08:27

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: http://caniuse.com/#feat=history

malcolmsparks09:08:05

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

malcolmsparks09:08:31

Google have a #! convention for that specific case

agile_geek09:08:15

@thomas: Real programming! 😉

benedek10:08:13

@jonpither: missed your previous comment (bad excuse but was on holidays), expez is working on a version of clean-ns on this branch: https://github.com/clojure-emacs/refactor-nrepl/commits/cljs-support 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}])

malcolmsparks19:08:31

you can use boolean true as a pattern

malcolmsparks19:08:48

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

malcolmsparks19:08:02

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