2.0.0 • Published 10 years ago

docpad-plugin-pluginmanager v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

Plugin Manager Plugin for DocPad

Build Status NPM version NPM downloads

Docpad plugin that enables the viewing and managing of plugins from within a docpad website. It's designed to function as part of a admin/CMS interface.

Screen shot

At the moment it adds the list of installed plugins to the docpad templateData which makes this data available to application templates. It also adds a description field to each plugin, pulled from the package.json file for each plugin and makes available data URLs to retrieve a plugin's readme file or package.json.

Default configuration

        config:
            readmeURL: '/admin/plugins/:pluginName/readme'
            packageURL: '/admin/plugins/:pluginName/package'

Example template (eco)

Eco template that generates a table listing the plugins used in an application.

<table width="100%">
  <thead>
    <tr>
      <th>Name</th>
      <th width="60%">Description</th>
      <th>Version</th>
      <th>Enabled</th>
    </tr>
  </thead>
  <tbody>
    <%plugins = @loadedPlugins%>
    <%for name,plugin of plugins:%>
    <%rowClass = if plugin.isEnabled() then "" else "disabled"%>
    <tr class="<%-rowClass%>" data-name="<%-name%>">  
      <td><a data-id="<%-name%>" class="readme-btn" href="/admin/readme/"><%-name%></a></td>
      <td><%-plugin.description%></td>
      <td><%-plugin.version%></td>
      <td><%-plugin.isEnabled()%></td>
    </tr>
    <%end%>
  </tbody>
</table>

License

Licensed under the incredibly permissive MIT license

Copyright © 2016+ Steve McArthur steve@stevemcarthur.co.uk (http://www.stevemcarthur.co.uk)