plop icon indicating copy to clipboard operation
plop copied to clipboard

Base path with relative path fails to find templates

Open tvvignesh opened this issue 5 years ago • 5 comments

Hi. I am using plop to generate a lot of boilerplate for my projects and it works great. Just encountered a scenario where,

THIS WORKS

{
                type: "addMany",
                destination: "./path/to/{{camelCase name}}",
                base: `my/templates`,
                templateFiles: "my/templates/**/*",
                stripExtensions: ["txt"],
                verbose: true,

 }

THIS DOES NOT WORK

{
                type: "addMany",
                destination: "./path/to/{{camelCase name}}",
                base: `./my/templates`,
                templateFiles: "my/templates/**/*",
                stripExtensions: ["txt"],
                verbose: true,

 }

The only difference is the prefix of ./ in the base config and plop is not able to find any files when using that. I am not sure if it is intended but thought i would let you know.

tvvignesh avatar Sep 19 '20 07:09 tvvignesh

Hi, I’m interested in contributing and would like to work on this issue. Could you please confirm if it’s okay for me to pick it up?

Sakthieswaran-tech avatar Oct 18 '25 17:10 Sakthieswaran-tech

Hi, just following up on this issue. I’m still interested in contributing and would love to work on it. Please let me know if it’s okay to start.

Sakthieswaran-tech avatar Oct 21 '25 18:10 Sakthieswaran-tech

I say go for it 👍🏻

amwmedia avatar Oct 21 '25 19:10 amwmedia

Thank you. I'll get started on it!

Sakthieswaran-tech avatar Oct 21 '25 19:10 Sakthieswaran-tech

I tested the behavior of addMany with and without the base property, including using ./ as a prefix. Specifically, I created a generator like this:

actions: [
    {
      type: "addMany",
      base: "./templates/components", // tried with and without "./"
      destination: "output",
      templateFiles: "templates/**/*.txt",
    },
  ]

When running the generator, Plop correctly found the template files and processed them in both cases. The ./ prefix did not affect file resolution.

It seems that Plop automatically calculates a “virtual base” from the glob pattern, which may explain why the explicit base is sometimes optional.

Conclusion: From my testing, the issue described does not reproduce on the current version. Please correct me if I missed something or tested it incorrectly.

Sakthieswaran-tech avatar Oct 23 '25 08:10 Sakthieswaran-tech