docpad-plugin-functions
v2.0.2
Published
Start functions between DocPad events
Downloads
1
Maintainers
Readme
Start functions between DocPad events
Install this DocPad plugin by entering docpad install functions into your terminal.
Usage
This plugin was inspired by docpad-plugin-gulp and 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.
(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
Discover the release history by heading on over to the releases page.
Discover how you can contribute by heading on over to the CONTRIBUTING.md file.
These amazing people are maintaining this project:
No sponsors yet! Will you be the first?
These amazing people have contributed code to this project:
Discover how you can contribute by heading on over to the CONTRIBUTING.md file.
Unless stated otherwise all works are:
and licensed under: