Skip to content

Start functions between DocPad events

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.md
Notifications You must be signed in to change notification settings

sdomagala/docpad-plugin-functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docpad-plugin-functions

Travis CI Build Status NPM version NPM downloads Dependency Status Dev Dependency Status
Slack community badge Patreon donate button Gratipay donate button Flattr donate button PayPal donate button Bitcoin donate button Wishlist browse button

Start functions between DocPad events

Install

Install this DocPad plugin by entering docpad install functions into your terminal.

Usage

This plugin was inspired by docpad-plugin-gulp, behaviour of this plugin is almost the same code-wise and in implementation BUT with slight differences:

  • you don't need gulp to run it
  • MAJOR: it's not spawning any child processes so it is 100% compliant with Windows/Unix.

AVAILABLE EVENTS

(not available renderDocument, and render since they caused memory spikes and shouldn't be used in this plugin)

Docpad.coffee structure

The following will run function validateDocuments during the generateBefore event:

validateDocuments = require 'validator.js' #this require should be at the top of docpad.coffee

  plugins:
    functions:
      generateBefore: [validateDocuments]
      writeAfter: [asyncFunction1, someOtherAsyncFunction2]

asyncFunction1 and someOtherAsyncFunction2 will be run in series

Function structure

Every passed function should have following structure with callback:

validator.js

function validateDocuments(cb) {

  checkFilesAsynchronously((err) => {
    cb(err);
  });
}

TO DO

  • support for sync calls
  • mechanism for easy passing arguments to functions

To be implemented if there is someone to actually use it, so feel free to file issues

History

Discover the release history by heading on over to the releases page.

Contribute

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

Backers

Maintainers

These amazing people are maintaining this project:

Sponsors

No sponsors yet! Will you be the first?

Patreon donate button Gratipay donate button Flattr donate button PayPal donate button Bitcoin donate button Wishlist browse button

Contributors

These amazing people have contributed code to this project:

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

License

Unless stated otherwise all works are:

and licensed under:

About

Start functions between DocPad events

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published