plop
plop copied to clipboard
stripExtensions doesn't work with dot files
I have, for example, a folder with a .babelrc and a package.json file in it. However, I'd like to pass some values into these files so I rename them .babelrc.hbs and package.json.hbs respectively.
Then when using them as templateFiles with an addMany action, the package.json file is correctly renamed but the .babelrc.hbs still has the hbs suffix.
Unless I'm missing something, this is hopefully solved by adding a simple check to the stripExtensions function, to make sure hidden files are included. I'd be happy to look into this and submit a pull request if that's the case.
Any update on this? It is currently preventing me from using this package, as I can't copy .gitattributes, .gitignore, .prettierrc, .eslintrc files, etc, if they require variables. I have fixed the issue in https://github.com/plopjs/node-plop/pull/192.
I have the same problem with .gitignore.hbs
A workaround is to rename the files and add some fake placeholder, like this:
{{fake}}.eslintrc.hbs
This will copy the file, remove the extension, and try to replace fake, but since it does not exsist as a variable, the result will be:
.eslintrc
it appears if only one file has one extension (e.g. y.hbs)
ls templates -a
.x.hbs a.b.c.hbs y.hbs
generated files:
.x.hbs a.b.c y.hbs
Transfering this issue to https://github.com/plopjs/plop/ since we're migrating all of node-plop to that repo as a monorepo
appreciate the fix @knikolov-nuvolo , this solved my issue