Wynn Netherland changelog.com/posts

Wintersmith - Static site generator powered by CoffeeScript, Jade, Underscore, and Node.js

We’ve covered a few static site generators, not to mention a whole episode. Wintersmith from Johan Nordberg is the first to be powered Node.js. Feature highlights include:

  • Jade templates
  • Page metadata
  • Integrated Underscore provides the _ function in your templates
  • Markdown support
  • Command line interface
  • Built-in server

Perhaps the most powerful feature is Wintersmith’s CoffeeScript-based plugin system:

module.exports = (wintersmith, callback) ->

  class TextPlugin extends wintersmith.ContentPlugin

    constructor: (@_filename, @_text) ->

    getFilename: ->
      @_filename

    render: (locals, contents, templates, callback) ->
      # do something with the text!
      callback null, @_text

  TextPlugin.fromFile = (filename, base, callback) ->
    fs.readFile path.join(base, filename), (error, buffer) ->
      if error
        callback error
      else
        callback null, new TextPlugin filename, buffer.toString()

  wintersmith.registerContentPlugin 'texts', '**/*.txt', TextPlugin
  callback()

Check out the project web site or source on GitHub for more.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00