
Gatsby – Static Site Generator with React and Webpack - csbartus
https://github.com/gatsbyjs/gatsby/blob/master/README.md
======
sago
Genuine question, not passive aggression. Why do static site generators always
revolve around blogs?

Blogs are around, sure, but they're a bit old-hat now, right? There are other
ways to arrange content. I've got my own single-file Python static site
generator, which could handle a blog, I guess, but it would seem odd to crown
that one application. Is it historical, from Jekyll? Or is blogging the
overwhelming use-case for static sites?

~~~
Touche
Great question, I'm not sure why media sites aren't all statically generated,
would be much more economical if nothing else. Ads can still be dynamically
loaded on the client, but content that never changes; why is that in a
database?

~~~
dkuntz2
When you've got multiple authors of varying technical skill, it's probably
significantly easier to give them a nice web server backend to interact with
than it is to try and teach them how to use the generator.

~~~
Touche
The backend is irrelevant to the interface the author uses.

~~~
Killswitch
But if the author needs to add content, they need to use the generator, if
they're using an interface, they're no longer on a static site.

~~~
Touche
No, they're in an admin application, which has no reason to be the same
"thing" as the site you're authoring.

This is what I'm talking about, people are so engrained in the way things
currently work that can't see obvious things like this. It's code, you can do
whatever you want.

~~~
narrowrail
I think making a desktop application using electron as the basis, and
embedding one of the SSGs would be interesting. Are you aware of anything like
that?

~~~
xtrumanx
Closest thing I can think of is Microsoft's WebMatrix.

------
jimktrains2
What are we pulling in such heavy machinery for a text-only site? It's things
like this that make people think it's OK to have a blog that isn't accessible
without JS which includes so screen readers.

~~~
tilt
This one is actually Universal ("Isomorphic" if you want), check
[https://www.reindex.io/](https://www.reindex.io/) for example.

~~~
jimktrains2
Interesting. I had expected it to be like bloger that just greets you with a
white screen; I didn't see his example blog earlier.

------
stackpush
I've been using [http://gohugo.io](http://gohugo.io) which has the same live
reload feature and is really fast and easy to work with.

------
xtrumanx
The docs page delivered 270kb of compressed and minified JavaScript (1MB
uncompressed) but sadly didn't seem to show anything with JavaScript disabled.
I thought all the hot new React apps were isomorphic nowadays.

~~~
Killswitch
Isomorphic does not mean works without JavaScript. Actually you need
JavaScript turned on for isomorphic to work.

On a related topic, I hate the term isomorphic. It's just JavaScript.

~~~
sylvinus
You don't need JavaScript if the server can generate all the pages and the
links are valid.

------
davexunit
Requiring JS to read pages of a static website is nonsensical.

~~~
lojack
Which is why this tool compiles the pages into static HTML before serving them
to the client.

Go ahead, disable javascript and visit any of the example websites.

~~~
deckard1
uh. This just means you end up with inverted PHP. Instead of PHP, where you
have a Perl-ish language generating HTML, you now have JS generating HTML. You
lose 100% of the benefit of React, which is the virtual DOM. You can literally
use any template language you want and achieve identical results here.

~~~
lojack
I'm not quite sure what your point is.

You say that the only use of react is the virtual DOM, so is it just that
React is a poor choice as a template engine? I'm not personally convinced, but
that's a bit of personal preference I suppose. The modularization and
composability of components is definitely nice, and not all template engines
do this well. I could certainly see how you may disagree with me though.

Is it that they aren't doing anything revolutionary? That's certainly true.
It's relatively trivial to make a static site generator that uses React, and
there's plenty of static site generators out there that use other engines. I
think using webpack to bundle everything up is pretty nice though.

Either way, my point wasn't that this project is particularly amazing, or
useful, just that it works with JavaScript disabled.

~~~
deckard1
> just that it works with JavaScript disabled

My point is, the whole point of React is to _use_ JavaScript. Otherwise it
just becomes yet another template language. Which every static site generator
already has.

It's also easy to screw up React and end up with JS on the client side.
Because that's the selling point of React (or isomorphic, to be exact)... JS
freely travels between backend and frontend without the developer really
caring much.

------
curiousjorge
what static site generators out there exists that is easy to setup on a ubuntu
server?

~~~
thirdsun
I'd assume all of them, no? Personally, I prefer Middleman, but of course
Jekyll is probably the most popular choice.

