These are chat archives for ractivejs/ractive

8th
Mar 2018
Cerem Cem ASLAN
@ceremcem
Mar 08 2018 13:19

quick survey: what is the most appropriate way to document an API method's function parameter?

.get docs, [opts, ] callback(err, res)
...
callback(err, res): ...

or

.get docs, [opts, ] callback
callback: is called with two parameters, err (error) and res (response if any)

kouts
@kouts
Mar 08 2018 13:20
not having really thought about this, I would say the first one
Cerem Cem ASLAN
@ceremcem
Mar 08 2018 13:30
which makes +2 (including me :) )
thank you
how about: .get docs::Mixed, [opts::Object, ] callback(err::bool, res::Array)is it too verbose?
kouts
@kouts
Mar 08 2018 13:33
yes that's too verbose (personal opinion always)
Cerem Cem ASLAN
@ceremcem
Mar 08 2018 13:42
ok, I'll go with the simple version
kouts
@kouts
Mar 08 2018 13:42
:+1:
Arnaud Dagnelies
@dagnelies
Mar 08 2018 14:09
hi
Joseph
@fskreuz
Mar 08 2018 14:09
When I rewrote the docs, I (loosely) followed MDN's style. I think they have a style guide, lemme look for it.
Arnaud Dagnelies
@dagnelies
Mar 08 2018 14:09
I thought I'll make some "example" website to cover usual stuff someone wants to do
like "how to" recepies / demos
here is what it would cover: https://dagnelies.github.io/ractive-examples/
Arnaud Dagnelies
@dagnelies
Mar 08 2018 14:10
do you think that would be a good idea? Is there some point that isn't really needed/relevant? Or something else that would be very useful / often asked?
Joseph
@fskreuz
Mar 08 2018 14:15
@dagnelies :thumbsup: Would be nice if they are linked on the docs, making the docs the jumping-off point for other resources.
Cerem Cem ASLAN
@ceremcem
Mar 08 2018 14:15
@dagnelies I would love it
Joseph
@fskreuz
Mar 08 2018 14:16
An FAQ section would also be nice too (whose content keys off of "Inquiries/Questions" issues in Github).
kouts
@kouts
Mar 08 2018 14:19
@dagnelies It would be nice if we can help too (my time is limited these days but I'll try)
Arnaud Dagnelies
@dagnelies
Mar 08 2018 14:20
sure, anyone is welcome to help
Cerem Cem ASLAN
@ceremcem
Mar 08 2018 14:20
@kouts your popup component might be listed in the repo, right?
Arnaud Dagnelies
@dagnelies
Mar 08 2018 14:20
just pick an example (or more) and go ahead
kouts
@kouts
Mar 08 2018 14:20
will you have the source as a github repo?
Arnaud Dagnelies
@dagnelies
Mar 08 2018 14:21
my popup component (modal dialog) is part of http://dagnelies.github.io/ractive-bootstrap/
for the repo, just click on the github logo in the upper right corner
Cerem Cem ASLAN
@ceremcem
Mar 08 2018 14:21
@dagnelies not popup, but modal, sorry
Arnaud Dagnelies
@dagnelies
Mar 08 2018 14:22
ah, sorry, didn't noticed you were speaking to kouts
Cerem Cem ASLAN
@ceremcem
Mar 08 2018 14:22
:)
I included your ractive-bootstrap once (maybe a year ago) to my project
then started editing slowly, to fit my needs. then switched to semantic-ui, so now I'm only using your approaches
Arnaud Dagnelies
@dagnelies
Mar 08 2018 14:26
glad you used it. It's nice to see I'm not the only one :P ...and yeah, there are so many css frameworks, it's not always easy to cope with so much diversity
Cerem Cem ASLAN
@ceremcem
Mar 08 2018 14:28
there are lots of components I might contribute with, but they are not at their latest version. ...and they uses semantic-ui :(
@fskreuz That's a guide I must follow too... but I didn't find an example of this bit
Arnaud Dagnelies
@dagnelies
Mar 08 2018 14:30
well, if they are bundled in a nice library with examples, it may turn into a nice thing too
@kouts I'll aslo provide a simple template if you want, so that it's easier to contribute
and if there is a specific example you are interested in contributing, just tell me!
kouts
@kouts
Mar 08 2018 14:42
ok @dagnelies thanks
IPbianco
@IPbianco
Mar 08 2018 15:20
Hello, anyone having trouble with dynamic image src been read as literal? (<img src="[[thumbnail]]"> doing a request to currentpath/[[thumbnail]]), the image gets rendered properly but I keep getting 404's in the logs, it's not happening all the time, I actually couldn't recreate the error but some edge case must be triggering it. I read there's an option in vuejs to use :src, is there something similar in ractive? Thanks!
Paul Maly
@PaulMaly_twitter
Mar 08 2018 15:23
Is this happens with dynamic expressions like {{thumbnail}} ?
IPbianco
@IPbianco
Mar 08 2018 15:24
Yes, exactly
Arnaud Dagnelies
@dagnelies
Mar 08 2018 15:26
dumb question but ...is the server returning the image correctly? (correct headers and such)
...and is the value of [[thumbnail]]always correctly set?
kouts
@kouts
Mar 08 2018 15:27
maybe putting the <img src="[[thumbnail]]"> inside an {{#if thumbnail ...
Arnaud Dagnelies
@dagnelies
Mar 08 2018 15:31
Nevermind my previous comment. I also suspect thumbnailis sometimes empty or has an erroneous value. That seems the most likely.
IPbianco
@IPbianco
Mar 08 2018 15:31
Yes, the images render correctly and the value from thumbnail is also right, the tricky thing is that i couldn't recreate the problem yet, meaning that I get lots of 404's in the logs (visits from other users) but when I browse around it it works just fine.
Arnaud Dagnelies
@dagnelies
Mar 08 2018 15:32
when you have 404 in the logs, you should also see what URL they are trying to reach. The question is: where are the 404 urls pointing to?
the other "maybe" is if some of your users have old IEs, that may cause some issue. Your page should also always have <meta http-equiv="X-UA-Compatible" content="IE=EDGE" />in the header to avoid that IE goes back in "old IE compatibility mode"
IPbianco
@IPbianco
Mar 08 2018 15:35
It's doing a get request to mycurrentpath/{{thumbnail}}
Arnaud Dagnelies
@dagnelies
Mar 08 2018 15:36
can we see it "in action"? do you have a link?
Perhaps it's also bots trying to crawl the pages
IPbianco
@IPbianco
Mar 08 2018 15:40
mm I wished I could be more descriptive but I don't see a way to share it in action, I will explore the IEs issue
Thanks for the help!
Arnaud Dagnelies
@dagnelies
Mar 08 2018 15:40
welcome
Joseph
@fskreuz
Mar 08 2018 15:41
Just wondering, how are your templates written? Inside <script>? Or DOM elements? Strings?
Chris Reeves
@evs-chris
Mar 08 2018 15:41
is your html actually severed from the server with src=[[thumbnail]] in it?
that would be the only thing in ractive, short of changing default delimiters, that would result in a request for ./[[thumbnail]]
served... sorry, mobile
Joseph
@fskreuz
Mar 08 2018 15:43
I have a strange feeling your templates are written inside divs (or some other non-inert element), which cause the browser to execute the template as real markup, and cause <img src="[[thumbnail]]"> to be processed as an actual <img> on the page.
Chris Reeves
@evs-chris
Mar 08 2018 15:43
this is why self driving cars are slightly terrifying
IPbianco
@IPbianco
Mar 08 2018 15:48
Yes, the delimiters were changed to [[ ]], the images causing trouble are inside "a" and "article" elements, and the whole thing is inside a partial "loop" like [[#partial blogpost]] [[/partial]]
IPbianco
@IPbianco
Mar 08 2018 15:55
The template is inside script elements
Joseph
@fskreuz
Mar 08 2018 16:03
Ok, that theory goes out the window. :D
kouts
@kouts
Mar 08 2018 16:14
have you tried the {{#if guard?
Arnaud Dagnelies
@dagnelies
Mar 08 2018 16:17
IMHO something is suspect about <img src="[[thumbnail]]"> resulting in a 404 mycurrentpath/{{thumbnail}}. Notice the [[thumbnail]] in the template resulting in {{thumbnail}} in the URL
IPbianco
@IPbianco
Mar 08 2018 16:18
No sorry, the result is also in [[thumbnail]], that was confusing
I will try the if guard
I tried the IE's issue using browserstack to try different browsers but doesn't seem to trigger the problem
Chris Reeves
@evs-chris
Mar 08 2018 18:59
you can also [[thumbnail || 'missing-image.jpg']] if the value of thumbnail is missing
Simon Layfield
@simonlayfield
Mar 08 2018 23:31
Holy smokes! Didn't know about @shared
Paul Maly
@PaulMaly_twitter
Mar 08 2018 23:33
Also see @global, @context and other special references. And don't forget, Ractive is fully featured)))
Cerem Cem ASLAN
@ceremcem
Mar 08 2018 23:34
separate topic: How can I make the following happen: Playground
briefly, how can we know if a variable is defined in the attributes (even it is set to null)?
Paul Maly
@PaulMaly_twitter
Mar 08 2018 23:36
strict condition I think
Cerem Cem ASLAN
@ceremcem
Mar 08 2018 23:38
I suppose there is something needed like ractive.hasListener()
@PaulMaly_twitter what is that mean?
Paul Maly
@PaulMaly_twitter
Mar 08 2018 23:43
I think you not able to find out if variable passed through attributes because Ractive hasn't separate data and props (like Vue or React). But if you know that variable could be a null you can just check it manually