mpetrovich / stylemark

Generate interactive style guides from Markdown.
MIT License
218 stars 35 forks source link

Excluded dirs are also watched #14

Closed rayax86 closed 6 years ago

rayax86 commented 6 years ago

Title says it all.

It is a bit unexpected that dirs excluded from being parsed are also watched for re-generation.

mpetrovich commented 6 years ago

I'm assuming you mean that the -w CLI parameter triggers regeneration when files in the excludeDir config setting are modified, is that correct?

If so, that is actually intentional.

excludeDir only excludes directories from being parsed for documentation comments. For example, you might set excludeDir to exclude a dist folder from being parsed. However, these same directories could be listed in the assets config setting, which will copy those directories to the generated styleguide.

Here's an example:

name: Bootstrap
logo: docs/assets/brand/bootstrap-solid.svg

excludeDir:
  - dist
  - docs

assets:
  - dist
  - fonts

For instance, if your compiled app JS and CSS lives in dist, you'll want them copied to the styleguide upon generation by listing them under assets. Furthermore, if you make changes to your JS and CSS, wouldn't you also want those changes reflected in the styleguide? Since the styleguide only references the assets that were copied during the last generation, you'd want those assets to be re-copied whenever they're changed. This re-copying occurs during re-generation, which is why we don't exclude the excludeDir from the file watcher.

Does this make sense?

mpetrovich commented 6 years ago

Closing for now; please re-open if you disagree.