These are chat archives for jescalan/roots

13th
Sep 2015
Michael Kornblum
@michaelkornblum
Sep 13 2015 05:08
Yes. More specifically the rendered HTML pages. The index page that typically shows up as localhost:1111 displays perfectly, but once I click a link of a page that lives within the posts folder, links start disappearing from the sidebar's rendered HTML. The main page content displays correctly. The thing that makes this issue all the more confounding is that I don't know which component is at fault. Could it be dynamic content, roots-records, lodash or moment?
Michael Kornblum
@michaelkornblum
Sep 13 2015 05:38
Btw, I've also put the codebase up in this repo https://github.com/michaelkornblum/roots-template-blog-deluxe, if you'd like a more detailed look at how its going off the rails.
Jeff Escalante
@jescalan
Sep 13 2015 07:27
roots doesn't deal with the dom at all
it just compiles your site one time, and that's it
so you are clicking around and things are moving or disappearing from the dom, that must be some js or css you are using...
Dominic Monroe
@SevereOverfl0w
Sep 13 2015 09:40
^ my thoughts too
@michaelkornblum I've figured it out
You've run into a race condition problem, by generating an index on each page, before each page has been fully loaded.
Michael Kornblum
@michaelkornblum
Sep 13 2015 15:15
@jenius, the css is relatively vanilla. The only real modification I did to it was to test the lost grid system. As for the client side JS, I haven't touched it at all.
This message was deleted
@SevereOverfl0w do you think that changing the source order of the template partials would remedy the situation? Maybe put the sidebar in after the content? Or is there a way to slow the compilation process, giving each partial template ample time to compile before its imported into the main layout?
Michael Kornblum
@michaelkornblum
Sep 13 2015 15:21
This message was deleted
This message was deleted
Dominic Monroe
@SevereOverfl0w
Sep 13 2015 16:05
@michaelkornblum I'm not actually sure what the proper solution is here actually. I'd defer to @jenius here.
Michael Kornblum
@michaelkornblum
Sep 13 2015 16:43
@jenius, as stated before the issue is not due to any browser-side css or js. But it definitely manifests in the compiled HTML. What are your thoughts?
Jeff Escalante
@jescalan
Sep 13 2015 17:27
Ah yes, this is a common problem many people run into
Most people automatically think it should be easily possible because dynamic site generators like rails etc can do this
Is the issue that you are trying to make other posts available on a single post page?
If not, then never mind haha
And I can take a look later, but not at the moment as I'm working
It would help if you dropped an issue in roots with a link to this repo and a thorough description of the issue
Dominic Monroe
@SevereOverfl0w
Sep 13 2015 17:31
In other situations, this might not make the cut -- for example if you are trying to access other dynamic content from within a single piece of dynamic content, all of the other ones might not be finished rendering when that particular one renders, so you can't guarantee they will all be present. For use cases like this, you can simply have this extension export all dynamic content to a JSON file that you can then pull with javascript. To do this, just pass a write key to the extension's initialization with the value being a path you want to write the json to (written relative to the public folder). So, for example:
@jenius I loaded up his example. Yes, that's the issue.
@michaelkornblum ^^ I knew I'd seen mention of it in the docs. It's not super explicit.
Jeff Escalante
@jescalan
Sep 13 2015 18:36
Yup. If anyone wants to write up something that they feel is more clear im welcome to PRs
Most people just expect it to work automatically, then immediately file an issue when it doesn't
i'd like to have a solution for it, but its a nasty issue and any solution would significantly slow down compiles and push the limits of an extension's abilities
if you think about it from the "how could i accomplish this technically" standpoint, it seems less worth it for a feature that is very infrequently necessary
Mathias Biilmann
@biilmann
Sep 13 2015 18:39
it’s much less mature than the dynamic content extension, but I made a small extension for handling Jekyll style posts, where each post is mardown with frontmatter and has a layout associated (so the posts themselves are not in jade, but in markdown)
this one loads the posts to memory during compilation, and then they should be available in all templates after they’re loaded
Jeff Escalante
@jescalan
Sep 13 2015 18:42
I'd be happy to add this feature to dynamic content if you figured out a good way to do it
Dominic Monroe
@SevereOverfl0w
Sep 13 2015 18:53
@jenius Could always be hidden behind a config option.
Jeff Escalante
@jescalan
Sep 13 2015 18:53
Depends on the consequences. If it causes a big slowdown, I'd support putting it behind a config option. If there's a way to do it without consequence, I'd be happy to make it the default. I just couldn't think of a way to do this
And haven't really had much time to consider it since, or a need for the functionality
This is as much all of our project as mine though, happy to review any and all PRs!
Dominic Monroe
@SevereOverfl0w
Sep 13 2015 18:55
I should check my assumptions, but I think this issue is probably deriving from rendering the view as soon as the file is available.
Potentially before other files have been loaded into memory.
Jeff Escalante
@jescalan
Sep 13 2015 18:55
thats how all of roots works
it runs everything as quickly as possible
Dominic Monroe
@SevereOverfl0w
Sep 13 2015 18:55
ah, there we go then.
Jeff Escalante
@jescalan
Sep 13 2015 18:55
haha
i hope you wouldnt want it any other way!
Dominic Monroe
@SevereOverfl0w
Sep 13 2015 18:56
I'm still trying to wrap my head around the whole pipeline.
Not for the most part, nope!
Jeff Escalante
@jescalan
Sep 13 2015 18:56
even still its not as fast as it could be because the languages' compiles are blocking
so while roots is set up to be async, it's actually sync. this is a particularly nasty issue that you can find a detailed description of in roots' issues section
if we could resolve it, it would boost roots' speed by like 10x. But it's reeeeal difficult
i left very detailed docs in the code about how it works
if i can help explaining anything link me to a line and let me know!
happy to help :)
Dominic Monroe
@SevereOverfl0w
Sep 13 2015 18:59
There's probably a really great explanation somewhere (probably those docs you mentioned), that I've glossed over / missed, and haven't grasped everything as well as I should.
Jeff Escalante
@jescalan
Sep 13 2015 18:59
it's super complex
i even have trouble keeping it all straight sometimes
its not a trivial task
there might be one other dev who has a pretty good understanding of how roots' internals work right now
it's not because it's bad code, or because people are stupid, it's just very complicated
if you want i can walk you though it sometime via screenhero or something
if you're ready for a real deep dive haha
Dominic Monroe
@SevereOverfl0w
Sep 13 2015 19:01
People are stupid.. sorta. The best devs acknowledge how tiny their skulls really are :p
I'll probably take you up on that, after I've had a short dive myself. Make sure I understand a fair amount first.
Something I did want to bring up is whether roots should emit a ".html" pass for ".jade" files. But I need to investigate it more first. I forgot to remind myself though
Jeff Escalante
@jescalan
Sep 13 2015 19:15
im not sure what you mean with that question, im sorry!
Jeff Escalante
@jescalan
Sep 13 2015 19:23
but yeah anytime just ping me and i'll try to find an hour
Dominic Monroe
@SevereOverfl0w
Sep 13 2015 21:59
Basically, after compiling a jade file, should the resultant html, be passed through the "pipeline" again? To allow things that modify html to be able hook in without having to name files ".html.jade"