testdouble/grunt-markdown-blog — pull request #6 by jasonkarns (2014-02-04 01:39:31+00:00)
Title: Dealing with missing templates/paths

I began this yak-shaving, rabbit-hole mission to make grunt-markdown-blog smarter when dealing with sites that don't have particular pages. For example, lineman-docs, which only need an index; no archive, posts, feed, or other static pages needed.

If you simply delete the relevant keys from the config (either for the destination path or the source templates), weird things happen. You either get errors during build, or empty output files, or empty-with-wrapper output files. So, here's what I think the goal state should be: (reminder, grunt warnings stop the build, but can be skipped with `--force`)

| | template (`options.layouts.*`) | destination path (`options.paths.*`) | behavior |
| ---------- | --------------------------------------| --------------------------------------- | ----------------|
| 1 | valid | valid | page created (yay!) |
| 2 | valid | undefined | error message |
| 3 | invalid (non-empty, but file missing) | valid | grunt warning |
| 4 | invalid (non-empty, but file missing) | undefined | error message |
| 5 | undefined | valid | error message |
| 6 | undefined | undefined | error message |

Scenarios 1 and 6 are pretty straight forward. All is good and the file is generated. Or everything has been removed and the file is skipped (with message).

I think the lack of a destination path should be all that's necessary to skip the file. Hence scenarios 2,4,6 all skipping the file(s) and printing a message regardless of the layout key. (Removing the template file itself and/or the config key is just cleanup at that point.)

Scenario 3 is also straight forward. If the destination path key is the primary decision factor, then it's presence would suggest the file is desired. Which implies the template file is just misconfigured somehow—bad path, missing file, wrong location, etc.—thus a grunt warning.

The questionable one is Scenario 5 (template undefined, destination path specified). Should removing the template key skip the file with just a log message? Or is that a warning?