News for hackers. Stuff that matters.
Re:Redux Blog Example by snake_case on Friday September 11, 2015 @10:35PM (#10207031)
I'm also working on a React + Markdown static site generator heavily inspired by Jekyll.

For the past few weeks, I've been experimenting with how I could render both React + Markdown into HTML and minimize the numerous edge cases that occur during the build process.

For example, ReactDOMServer.renderToStaticMarkup(page) will remove all line breaks in the HTML output. The problem with that is pre/code elements will have their line breaks removed as well which for obvious reasons is not good. Oh and another problem, it converts all (or most, if I remember correctly) HTML entities to their literals.. so those code blocks may look pretty messed up in the browser.

But after weeks of experimenting with different rendering/build processes and libraries, things have finally been coming together recently. Unfortunately, my private repo is a mess due to all the tests and methods I've tried. I'm going to be releasing a clean public repo of the project soon after I develop a landing github.io page for it. That will also be open source and serve as a great example for how to use the generator.

However, I did rewrite my live website from Jekyll to my generator (need to come up with a good name still..) this past week.

http://jakedeichert.com

Regarding build times on my $5 DigitalOcean droplet, my website is built in ~3.7s with Jekyll and ~9.5s with my generator. I still have many ways to improve performance and I haven't tested NODE_ENV production mode yet which the React team says should be much faster due to no warnings/error checking. Though, most of that build time is due to Babel converting my ES6+JSX components into actual JS that Node can execute. I'll be focusing on lowering this build time for the next week or two probably.

Re:Redux Blog Example by bjt on Saturday September 12, 2015 @01:38AM (#10207367)
Very cool project.

But two weeks to shave off 6 seconds of build time?

I gotta wonder: https://xkcd.com/1205/

Re:Redux Blog Example by snake_case on Saturday September 12, 2015 @02:58AM (#10207504)
I'm hoping to drop the 9.5s to more like 4-5s. I don't think it can reach the speed of Jekyll since Babel is heavily used to convert the jsx to js at the start of the generation. If everyone wrote pure js React code, then the babel step would essentially be eliminated which should definitely be a config option.

Dropping at least a second or two should be easy. My code is a beautiful mess right now, and I know there's so many parts I can improve, let alone also using the production version of React instead of the warning/error checking version.

Also, when I say 2 weeks, I actually meant more like 40 hours over the course of 2 weeks. It's a side project :)

Re:Redux Blog Example by dchuk on Saturday September 12, 2015 @02:55AM (#10207496)
Not that it really matters, but his system added 6s of build time, not shaved it off