Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding custom task #98

Open
phun-ky opened this issue Jul 5, 2016 · 1 comment
Open

Adding custom task #98

phun-ky opened this issue Jul 5, 2016 · 1 comment

Comments

@phun-ky
Copy link

phun-ky commented Jul 5, 2016

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"
    }
  ]
},
@jonschlinkert
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants