How to create DocPad plugin?

I did all steps from here:

1) created simple plugin /plugins/myplugin/myplugin.plugin.coffee with this code:

module.exports = (BasePlugin) ->
  class MyPlugin extends BasePlugin
    name: 'myplugin'
    renderBefore: ({templateData}) ->
      templateData.foo = 'bar'

2) /plugins/myplugin/package.json

{
  "name": "myplugin",
  "version": "2.0.0",
  "main": "./src/myplugin.plugin.coffee"
}

3) /src/documents/index.html.eco

<p><%= @foo %></p>

But plugin doesnt work. It isn't in DocPad's log info: Plugins: eco and throws error ReferenceError: foo is not defined.

What did i miss?

You have /plugins/myplugin/myplugin.plugin.coffee and then reference it with "main": "./src/myplugin.plugin.coffee" - which expectes the plugin file to be inside a src directory like so: /plugins/myplugin/src/myplugin.plugin.coffee - you'll need to correct one of these.

If you can link me to the place where the documentation confused this, I'll happily fix it.

DocPad also requires plugins to have the following inside their package.json file:

"keywords": ["docpad-plugin"]