forestryio / create-static-site

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

lerna All Contributors

Create Static Site

Create static websites with no build configuration.

Overview

npx create-static-site my-site --template hugo
cd my-site
npm start

(npx comes with npm 5.2+ and higher)

Then open http://localhost:3000/ to see your app.

Creating a Static Site

You’ll need to have Node >= 6 on your local development machine. You can use nvm (macOS/Linux) or nvm-windows to easily switch Node versions between different projects.

To create a new app, run:

npx create-static-site my-site --template [template]

Replace [template] with either hugo or jekyll.

It will create a directory called my-site inside the current folder.
Inside that directory, it will generate the initial project structure and install the transitive dependencies:

my-site
├── LICENSE
├── node_modules
├── package.json
├── README.md
├── static-scripts.config.js
├── .browserslistrc
├── .eslintrc.yml
├── .gitignore
├── .postcssrc.js
├── .stylelintrc.yml
├── site/ # Depends on the static site generator
└── src/
    ├── css/
    │   ├── styles.css
    │   └── imports
    │       └── resets.css
    ├── img/
    │   └── svg/
    │       ├── bitbucket.svg
    │       ├── github.svg
    │       └── gitlab.svg
    └── js/
        ├── scripts.js
        └── imports/
            └── index.js

No configuration or complicated folder structures, just the files you need to build your site.
Once the installation is done, you can open your project folder:

cd my-site

Inside the newly created project, you can run some built-in commands:

npm start or yarn start

Jekyll users will need to run bundle install first

Runs the app in development mode.
Open http://localhost:3000 to view it in the browser.

The page will automatically reload if you make changes to the code.

npm build or yarn build

Builds the site for production to the dist folder.

Philosophy

What's Included?

Your environment will have everything you need to build a modern static website:

The tradeoff is that these tools are preconfigured to work in a specific way. If your project needs more customization, you can "eject" and customize it, but then you will need to maintain this configuration.

Static Sites

Static sites are websites built using static, unchanging files. Because the content is static, delivering it to users requires no server processing time. This feature makes static sites incredibly fast and performant.

Static site generators are the modern way of building static sites. They convert simple, text-based content files in static files ready for the web.

They’re fantastic for developers because they are extremely fast, are built to work with version-control, and require little-to-no setup compared to existing monolithic CMS solutions like Wordpress.

Currently, create-static-site supports two static site generators:

Contributing

We'd love to have your helping hand on create-static-site! See CONTRIBUTING.md for more information on what we're looking for and how to get started.

Contributors

Thanks goes to these wonderful people (emoji key):


chrisdmacrae

💬 💻 🎨 📖 💡 🤔 👀 📢 🔧

ncphillips

💬 🐛 💻 📖 💡 🤔 🚇 👀 📢 ⚠️ 🔧

Bryan Klein

🐛 📖 🤔

Scott Gallant

🐛 📖 🤔

DJ

💻 🐛 📝

Sebastian Engels

🐛 🤔 💻 📖

Adam

🐛

This project follows the all-contributors specification. Contributions of any kind welcome!

Acknowledgements

This project is greatly inspired by the wonderful create-react-app project.