Skip to content

2.0 plugin migration

Johan Nordberg edited this page Jul 3, 2013 · 2 revisions

There are a few changes to the plugin API in Wintersmith 2.0. You will need to update your plugins to make them compatible.

There are tree major changes:

  1. ContentPlugin.fromFile method is now called with a filepath object instead of filename and base. The object contains both the relative (to the contents directory) path and the full path to the file on the filesystem. filepath.relative and filepath.full respectively.

  2. Plugin modules are now called with an Environment instance, it is compatible with the old API but you should be aware.

  3. The ContentPlugin's render instance method is now succeeded by the view property, subclasees should implement the getView method which can return a function (same interface as the old render method) or a string referencing a global view.

Wintersmith now has a simple plugin manager, if you want your plugin to show up in the listing you have to publish it on npm and add the wintersmith-plugin keyword to your package.json.

Check the plugin template repo for an example of a 2.0 plugin: https://github.com/jnordberg/wintersmith-plugin

Clone this wiki locally