verb
verb copied to clipboard
Adding custom task
I have this in my package.json, generating a nice README.md with verb-readme-generator as devDependency and verb installed globally:
"verb": {
"toc": true,
"tasks": [
"readme"
]
},
Is it possible to add a task (without adding a file) to produce another type of .md file? For example:
"verb": {
"toc": true,
"tasks": [
"readme",
"styleguide": {
"includeDir": "/path/to/include other files from into .styleguide.md",
"input": ".styleguide.md",
"output": "/foo/bar/styleguide.md"
}
]
},
without adding a file
What you're describing is idea for a plugin/generator, since you would only need to require it into plugins where it's needed, and you wouldn't need to add a file in your local project.
Example:
module.exports = function(app) {
// setup tasks to do what you need. If a `default` task
// is defined, verb will run it when the generator is called
// e.g. `$ verb readme` actually runs `$ verb readme:default`
};
also, instead of defining options in the tasks array, you would want to move that to the root of the verb object, or options (it would be up to your generator or plugin):
"verb": {
"toc": true,
"options": {
"styleguide": {
"includeDir": "/path/to/include other files from into .styleguide.md",
"input": ".styleguide.md",
"output": "/foo/bar/styleguide.md"
}
},
"tasks": [
"readme",
"styleguide"
]
},