forestryio / create-static-site

Create static websites with no build configuration.
MIT License
135 stars 10 forks source link

Create a "blank" default template #34

Open chrisdmacrae opened 6 years ago

chrisdmacrae commented 6 years ago

Right now you have to specify --template hugo|jekyll. I don't love this for two reasons:

Instead, I propose running create-static-site <dirname> creates the bare minimum of a static site -- asset processing & static files.

This could then evolve into a few other "bare-minimum" templates like a react -> toString template.

Thoughts? @ncphillips @budparr @scottgallant ?

budparr commented 6 years ago

Those tools have unique directory structures, which would mean you'd manually have to create them, correct?

chrisdmacrae commented 6 years ago

@budparr The power of C-S-S is that you can provide a template with any directory structure or files.

In this scenario, I'd just imagine getting a site that looks like:

src/
  css/
  js/
  img/
site/
  *.html
dist/
.gitignore
static-scripts.config.js
README.md

And my static-scripts.config.js would look as follows:

/**
 * Configuration file for create-static-site
 * A zero configuration build tool for static sites
 * https://github.com/forestryio/create-static-site/
 */
const {resolve} = require("path")

module.exports = () => ({
    generator: "Generator",
    command: "cp",
    proxy: false,
    args: {
        default: [resolve("site/"), resolve("dist/")],
    },
    directories: {
        src: "src/",
        build: "dist/",
        static: "dist/",
        generator: "site/"
    }
})

Just an extremely slim MVP that allows me to prototype static HTML w/ asset processing.

budparr commented 6 years ago

At some point you have to specify what tool you're using, why not up front? Perhaps I'm still missing something 🦆 (duck emoji because they had no dunce)

chrisdmacrae commented 6 years ago

I guess my thought is create-react-app is 0 configuration, extremely straightforward. I want to eliminate the "choice of tool" if you're absolutely brand new to static sites.

E.g, I'm using CRA because I want to build a react app. With C-S-S, I'm using it to build a website. My initial choice becomes harder if I have to choose Jekyll, or Hugo, or Hexo, etc...

I'm thinking the most basic from of C-S-S, it provides:

And we consider full-featured "generators" as an add-on, allowing developers to crowd-source development of as many "generators" templates as they like.

Thoughts?

budparr commented 6 years ago

I see. Bare Metal.

best-practise javascript w/ webpack

Are you thinking separate files for prod/dev or one? I went with one to keep it simple, but now you've got me studying CRA and am musing over having two.

chrisdmacrae commented 6 years ago

I went with two webpack configs because they're so heavy and I have detailed comments.

ncphillips commented 6 years ago

Agreed. We use one webpack configuration at Forestry right now, and I deeply regret it. The duplication is worth the simplicity.

Germoe commented 6 years ago

I think it would be helpful to give users the option to choose a template. If we consider that static site generators are pretty new to most of our users than we should make it very easy for them to use C-S-S with the template of their choice.

Say a user wants to use Jekyll the CLI could install the blank template and then prompt the user in a second step whether they would like to install an SSG (Jekyll, Hugo, Hexo etc.). Taking this a step further it maybe should even prompt them if they wanted to install a theme or not in a third step (I think it's really difficult to figure out how to add a theme to C-S-S at the moment). Vue.js has solved the CLI experience beautifully -> screen shot 2018-05-02 at 4 17 16 pm

This might be less zero config but is in my opinion more in tune with what Create-React-App did for me. Run a command in the CLI and have a fully functioning app already pre-loaded with a theme so I have to only adjust code rather than write code from scratch and pick and choose providers myself.