Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Andrey Popp
@andreypopp
Welcome!
Frank Wilson
@zenlambda
Definitely interested in static site generators with ReactJS. I've been working on one that uses webpack. Of course, I can't stop myself wanting to get hot module reload to work with markdown files :P . For some reason I can't find a way to make it happen with 'dynamic' contexts.
Andrey Popp
@andreypopp
Hi, @zenlambda!
zenlambda: do you mean reloading when new files is added?
It's not yet implemented in sitegen. But I think it's not that hard.
Frank Wilson
@zenlambda
Yes, without a browser refresh.
Andrey Popp
@andreypopp
Basically you need to accept context module from inside the module which creates a context.
Let me find the relevant explanation from @sokra
cc @KyleAMathews, as you also wanted this, I think
or maybe I wrong, I didn't check it yet, tbh
Frank Wilson
@zenlambda
Yes I saw that one. I did things similarly to how sokra described. The client is notified of the update, I even saw the patch file, but for some reason, even though apply is called the new content is not loaded.
Andrey Popp
@andreypopp
ok, I've created andreypopp/sitegen#16
will report back when I will try to implement this
Mikołaj D.
@mik01aj
Hi guys, I'm curious: how does sitegen compare with https://github.com/jaredly/demobox ? I'm looking for a react style guide tool.
Spencer Elliott
@elliottsj
hey, i'm wondering what the current status of this project is. between sitegen, https://github.com/gatsbyjs/gatsby, and https://github.com/MoOx/statinamic/, i think sitegen has the simplest API and the best approach to deal with the build tool fatigue of configuring webpack, hmr, etc.
also, is there an API for getting the currently-rendered page metadata (markdown frontmatter) from inside a chrome component? e.g. to display a title metadata value
Sergey Lukin
@sergeylukin
Hi, sitegen works really nice. Thank you for sharing it! I was trying to understand sitegen's source code and stumbled upon transformation of public methods like includePage in src/index.js by src/babel/QueryAPIBabelPlugin.js Wow, I had to grep for includePage throughout the repo in order to find the place where it's rewritten. Can someone explain me the reasoning behind transforming the code like that? It looks so mysterious to me.
Andrey Popp
@andreypopp
@sergeylukin Hi, it's to hide implementation details and not to expose loaders in code.
includePages('./posts/*') is better than require('page?glob=./posts/*!')
Sergey Lukin
@sergeylukin
@andreypopp Got it. Although I’d prefer uglier but more straight-forward implementation I’ve got something to learn from here :)
Andrey Popp
@andreypopp
@sergeylukin I'm just unsure includePages or meta will be implemented as a loader + require in the future versions.
But yeah... could be simpler I guess.
@elliottsj Hey, sorry for late reply. Currently we use https://github.com/nfl/react-helmet through <Sitegen.Meta /> so any page can inject <title /> or <meta /> into the <head />.
Sergey Lukin
@sergeylukin
@andreypopp sounds interesting. looking forward to it
Spencer Elliott
@elliottsj
@andreypopp no worries! i was actually wondering if there was a way to get the metadata for the currently-rendered "child" page from a parent component. e.g. if i have pages/posts.js_ and many posts in _pages/posts/*.md (and posts.js has includePages('./posts/*.md')), is there a way for the posts.js component to get frontmatter values from the currently-rendered page and display them? something like:
// posts.js
export class component extends React.Component {
  render () {
    const pageMeta = getCurrentPage().meta
    return (
      <div>
        <h2>{pageMeta.title}</h2>
        <span className='post-date'>{formatDate(pageMeta.date)}</span>
        {this.props.children}
      </div>
    )
  }
}
Andrey Popp
@andreypopp
@elliottsj just pushed a v0.14 release which allows to access currently matched routes in components:
let currentRoute = this.props.routes[this.props.routes.length - 1]
console.log(currentRoute.meta)
Andrey Popp
@andreypopp
After React Router hits 2.0 I'll try to make it more concise: this.props.currentRoute.meta or something like that.
Spencer Elliott
@elliottsj
Awesome, thanks!
cutemachine
@cutemachine
Hello Andrey. Thanks for the great project.
Is the source of the documentation site (https://sitegen.github.io/) on GitHub somewhere? Would like to look at the source to learn from it.
Andrey Popp
@andreypopp
@cutemachine sorry for late reply!
cutemachine
@cutemachine
Not late at all. Thanks.
Is there an easy way to add Jeet (https://github.com/mojotech/jeet) to a Sitegen project? Jeet is based on Stylus and I do not know how I can add a webpack loader to Sitegen.
Andrey Popp
@andreypopp
@cutemachine at the moment the best way is to fork sitegen, I'll add needed hooks soon
cutemachine
@cutemachine
Yes, hooks would be cool. Let me know if I could help with anything. Keep up the good work.
Andrey Popp
@andreypopp
@cutemachine I'd happily take PR which allows to inject custom loaders for sitegen
:-)
cutemachine
@cutemachine
:-)
Khoa Nguyen
@thangngoc89
hi :)