Can I disable a plugin for a specific directory?

I have a generator plugin which finds Typescript files and compiles them into Javascript. It works fine. However, I also have some Typescript files which don’t compile — they’re intended to be served statically instead.

Is there a better way to disable the plugin for that specific directory than what I’m doing at the moment, which is adding next if sf.path.include?(directoryName) in its inner loop? Such as a per-directory config file telling Jekyll not to call that specific plugin?

One idea is to use Jekyll’s defaults mechanism to set a flag for the files to include/exclude them from processing. For example, you could define a compile_typescript flag for a whole directory:

defaults:
  -
    scope:
      path: "static-typescript-dir/"
    values:
      compile_typescript: false

Then the plugin would check for the flag in the inner loop (if sf.compile_typescript ...) before compiling.