code-template-tool
code-template-tool copied to clipboard
Some replacements is special cases are not replaced as expected
I have two instances where the replacement values do not work as expected.
The first is in implementing a common pattern for NextJS pages where the eventual file or folder name requires to be an all lowercase term followed by id and wrapped with square brackets - so a file or folder may be named [cityaliasid].
I have a variable templateName: cityAlias.
if I use [___templatename___id]
as the value for the filename or the folder the value is not replaced when creating the file or folder. However if I use [___templateName___]
the value IS replaced but of course the result includes a capital which needs to be dealt with after the template has run.
The other case is in the replacement of a value within a file where I have a pathname that must be preceded by "/" In this case the template contains path={"/___templatename___"}
- again the value is not replaced.
All other instances of variables in the templates and filenames are working exactly as expected and correctly case.
I guess the issues result from RegEx syntax being confused by the character appearing immediately before the template.