This past weekend was a very productive one for me, because I’ve started to work on and released my book’s one-page website —rapidprototypingwithjs.com. I’ve used Wintersmith to learn something new and to ship fast. Wintersmith is a Node.js static site generator. It greatly impressed me with flexibility and ease of development. In addition I could stick to my favorite tools such as Markdown, Jade and Underscore.
Why Static Site Generators
Here is a good article on why using a static site generator is a good idea in general, An Introduction to Static Site Generators. It basically boils down to a few main things:
You can use template engine such as Jade. Jade uses whitespaces to structure nested elements and its syntax is similar to Ruby on Rail’s Haml markup.
I’ve copied markdown text from my book’s Introduction chapter and used it without any modifications. Wintersmith comes with marked parser by default. More on why Markdown is great in my old post, Markdown Goodness.
Due to the fact that any static web server will work well, there is no need for Heroku or Nodejitsu PaaS solutions, or even PHP/MySQL hosting.
There are no database calls, no server-side API calls, no CPU/RAM overhead.
Wintersmith allows for different plugins for contents and templates and you can even write you own plugin.
Getting Started with Wintersmith
There is a quick getting started guide on github.com/jnordberg/wintersmith.
To install Wintersmith globally, run NPM with -g and sudo:
$ sudo npm install wintersmith -g
Then run to use default blog template:
$ wintersmith new <path>
or for empty site:
$ wintersmith new <path> -template basic
or use a shortcut:
$ wintersmith new <path> -T basic
Similar to Ruby on Rails scaffolding Wintersmith will generate a basic skeleton with contents and templates folders. To preview a website, run these commands:
$ cd <path> $ wintersmith preview $ open http://localhost:8080
Most of the changes will be updates automatically in the preview mode except for the config.json file.
Wintersmith generator has the following logic:
- looks for *.md files in contents folder,
- reads metadata such as template name,
- processes *.jade templates per metadate in *.md files.
When you’re done with your static site, just run:
$ wintersmith build
Other Static Site Generators
Here are some of the other Node.js static site generators:
More detailed overview of these static site generators is available in the post, Node Based Static Site Generators.
For other languages and frameworks like Rails and PHP take a look at Static Site Generators by GitHub Watcher Count and the “mother of all site generator lists”.
6 thoughts on “Wintersmith — Node.js static site generator”
There is a typo. In
wintersmith new -template basic
should have two dashes before 'template'.
I created this dashboard to track the Github stats of the leading static site generators.
Check it out: http://www.staticgen.com
Wintersmith is kicking butt!
It’s usually in the top row for “New Stars this week”.
I’m thinking to use it for the blog of BitBalloon ( a static site optimization and deployment service )
Thanks for reaching out. What type of articles would you like to submit? Do you have links/samples to your writings? If your topics are related to web and mobile development they can be a great addition to webapplog.com.
Recently I came across some great articles on your site. The other day, I was discussing (http://www.webapplog.com/wintersmith-node-js-static-site-generator/) with my colleagues and they suggested I submit an article of my own. Your site is just perfect for what I have written! Would it be ok to submit the article? It is free of charge, of course!
Let me know what you think
Contact me at email@example.com
I have just (as in a couple days ago) made available a new “static site generator” written in Node.js. It’s named AkashaCMS – you can see it at akashacms.com. For me “Jade Templates” was a showstopper and I had looked at some of the others you named, and decided to build my own. One difference is that AkashaCMS incorporates an asynchronous template engine, so that you can do things like database or REST queries while processing a page.