Skip to content

Commit

Permalink
Hack in support for loading plugins when invoking Wintersmith program…
Browse files Browse the repository at this point in the history
…matically, borrowing the loadPlugins from the cli interface. Possibly fixes jnordberg#32
  • Loading branch information
ajpiano committed Jul 11, 2012
1 parent 29690ad commit e120f21
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/index.coffee
Expand Up @@ -4,6 +4,7 @@ async = require 'async'
{ContentTree, ContentPlugin, registerContentPlugin} = require './content'
{TemplatePlugin, loadTemplates, registerTemplatePlugin} = require './templates'
renderer = require './renderer'
{loadPlugins} = require './cli/common' # cli common

defaultPlugins =
Page: require('./plugins/markdown-page')
Expand All @@ -27,8 +28,11 @@ module.exports = (options, callback) ->
contents: path to contents
templates: path to templates
output: path to output directory
plugins: array of paths to plugins
locals: optional extra data to send to templates ###

options.plugins = options.plugins ? []

logger.verbose 'running with options:', {options: options}

# load templates & contents then render
Expand All @@ -37,6 +41,7 @@ module.exports = (options, callback) ->
async.parallel
contents: async.apply loadContents, options.contents
templates: async.apply loadTemplates, options.templates
plugins: async.apply loadPlugins, options.plugins
, callback
(result, callback) ->
renderer result.contents, result.templates, options.output, options.locals, callback
Expand Down

1 comment on commit e120f21

@DAddYE
Copy link

@DAddYE DAddYE commented on e120f21 Jul 27, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Please sign in to comment.