Skip to content

Instantly share code, notes, and snippets.

@sindresorhus
Created December 28, 2013 14:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sindresorhus/8159792 to your computer and use it in GitHub Desktop.
Save sindresorhus/8159792 to your computer and use it in GitHub Desktop.
Braindump of Grunt plugin guidelines
  • plugins should only do one thing and do them well. Your task shouldn't concat files that's why we have grunt-contrib-concat. Your task shouldn't minify CSS, that's what eg. grunt-csso is for.
  • don't bloat with uneeded options. pick sane defaults.
  • should be fully tested (this should be enforced! we really don't want people using untested plugins).
  • search the plugin list before creating one. what you want to create is probably already created and all you're doing is making it harder for users to find one.
  • don't use the prototyped colors properties like, ''.green. This will be deprecated in the future. Use a sane coloring lib like chalk instead.
  • readme:
    • should have a good intro
    • travis badge
    • have examples
    • describe all options with types and defaults
    • license
    • (we should show an example of how it's done)
  • use async as much as possible.
  • don't be slow. time (grunt yourplugin) will tell you how slow you are. So will time-grunt.
  • don't create useless grunt wrapper plugins that could be just as easily used directly as a node module.
  • be a responsible maintainer. if you don't intend to maintain it don't release it. if you no longer have time to maintain it, say so, there might be someone that does.

And most important of all; the grunt docs needs to be much better!

Also keep in mind that a lot of the awfulness in grunt plugins comes from limitations in grunt itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment