verb icon indicating copy to clipboard operation
verb copied to clipboard

Adding custom task

Open phun-ky opened this issue 9 years ago • 1 comments

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"
    }
  ]
},

phun-ky avatar Jul 05 '16 07:07 phun-ky

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"
  ]
},

jonschlinkert avatar Jul 05 '16 10:07 jonschlinkert