Fork me on GitHub
#hoplon
<
2015-11-09
>
thedavidmeister09:11:58

is there a “best practise” solution for this yet? https://github.com/hoplon/hoplon/issues/68

thedavidmeister09:11:10

is this something i should use cljsjs for?

micha12:11:45

when you can, yes

micha12:11:58

but sometimes the 3rd party thing relies on being in a script tag

micha12:11:17

like it will try to find its own script tag and things like that

micha12:11:34

if it's just javascript code then definitely cljsjs is the way

andrewboltachev15:11:06

Hi guys. AFAIK now it's possible to define handlers for specific URLs like "/", "/something.html" and "/something/". Is it possible to make custom handler like "/foo/<some-id>"?

andrewboltachev15:11:08

In other words — to not to have page (somepage.cljs.hl), for each handler, but make one page expose series of handlers?

micha15:11:17

you can use the hash fragment or pushState for that

micha15:11:36

if you use pushState you still need to be able to serve the application at all urls in the server

micha15:11:01

which means either making lots of html files, one for each path, or some kind of shenanigans on the server

micha15:11:20

i recommend using the uri fragment approach, myself

andrewboltachev15:11:21

that makes, sense, but I'd do it more composable. i.e. having different URL displaying different data one might call "views" abstraction, and URL fragments or "real" URLs (classic reloads and usign pushState would be possibe approaches) would be different implementations for it.

andrewboltachev15:11:32

this has sth to do with SEO also, i.e. what does website look like for search engine, not for human users only

andrewboltachev15:11:44

@micha: btw, I remember you told me that pushState is somewhat "naïve" in terms of HTTP model. I can't get details on my own yet

andrewboltachev15:11:17

i.e. can't understand the problem on my own

micha15:11:22

the SEO issue is something to think about

micha15:11:43

i would be surprised if google doesn't know how to index single page apps in 2015

andrewboltachev15:11:17

ah, I didn't even think it can do this

andrewboltachev15:11:44

btw, how did you manage for source of http://hoplon.io to have actual content?

micha15:11:49

we use the prerender task

micha15:11:56

it loads the page in phantomjs

micha15:11:05

and then merges the html

micha15:11:27

we also have a task for rendering according to google ajax crawling protocol

micha15:11:36

which is supported by all web crawlers you care about

micha15:11:53

i.e. if you have a link in your page like #!foo/bar

micha15:11:16

google will actually make a request to ?escaped_fragment=foo/bar

micha15:11:42

so we have ring middleware that intercepts those requests and renders the page in phantomjs or htmlunit or whatever

andrewboltachev15:11:50

"escaped_fragment" being "magic" param?

andrewboltachev15:11:33

AJAX Crawling (Deprecated)

andrewboltachev15:11:38

what about others like http://ask.com or whatever?

micha15:11:49

they all do what google does, as far as i know

andrewboltachev15:11:17

well and that means that URL fragments become more important along the way

andrewboltachev15:11:36

really didn't think about something like that

micha15:11:58

the url fragment was designed for that

micha15:11:10

in the uri spec, they anticipated all of this

andrewboltachev15:11:53

do you plan to implement some built-in support for them? something like "dynamic views" may be?

micha16:11:13

how do you mean?

micha16:11:17

dynamic views

andrewboltachev16:11:11

few things, that I had few times in my projects: 1. List (or may be map, may be set?) of views. And each view is map, that contains few things. 2. Each view is a block inside (body ...) 3. Each view has some API methods associated with it. :get is obligatory it gets it's data from the server when one opens view 4. When one opens view — that's the key point. This is achieved via "on-load" event (for first view that were opened) and by watching route cell as well

andrewboltachev16:11:38

very rough and not-yet-consistent description

andrewboltachev16:11:18

and also 5. state cell, that contains some :view-data in it, which would be returned by :get method

andrewboltachev16:11:22

dynamic here means one that uses URL fragments and doesn't do full reload (even any reload)

micha16:11:19

yeah that's similar i think to what we have in the application we're working on here

andrewboltachev16:11:00

ok, I'll try to find time to write blog post (and create blog itself, LOL) about what I came up with on that issue. and it would be interesting to see what we have in common and what differs etc

micha16:11:31

that would be great!

micha16:11:59

what we have isn't fully formed, i'd definitely appreciate seeing some new ideas there

bsima19:11:40

In Javelin CLJS you use deftype Cell, but in Javelin CLJ you use metadata, is there a reason for this?

bsima19:11:01

...i guess it just wasn't implemented yet, since the tests that test for #<Cell... presentation were commented out

flyboarder20:11:32

@andrewboltachev: I have a semi formed solution in place for the views issue as well, currently if you take a look at https://elements.polymer-project.org/elements/iron-pages this is a polymer based solution but it works extremely well and hooked into route-cell with a little jQuery work around. I have a polymer wiki post in progress which ill probably post later today

flyboarder20:11:44

trying to get the demo app working on Heroku 😛

alandipert20:11:15

@bsima: i think hte original reason for the difference was when the clj version was made there weren't ISwap etc protocols, so it wasn't possible to make your own atom-like thing

alandipert20:11:35

but these have been in cljs from the start