Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stripExtensions doesn't work with dot files #324

Closed
rwacarter opened this issue Jun 23, 2020 · 6 comments · Fixed by #366
Closed

stripExtensions doesn't work with dot files #324

rwacarter opened this issue Jun 23, 2020 · 6 comments · Fixed by #366

Comments

@rwacarter
Copy link

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.

@rwacarter
Copy link
Author

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 plopjs/node-plop#192.

@rwacarter rwacarter changed the title stripExtensions doesn't work with hidden files stripExtensions doesn't work with dot files Nov 2, 2020
@JacekKosciesza
Copy link

I have the same problem with .gitignore.hbs

@knikolov-nuvolo
Copy link
Contributor

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

@smmoosavi
Copy link

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

@crutchcorn
Copy link
Member

Transfering this issue to https://github.com/plopjs/plop/ since we're migrating all of node-plop to that repo as a monorepo

@oneezy
Copy link

oneezy commented Sep 6, 2022

appreciate the fix @knikolov-nuvolo , this solved my issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants