-
Notifications
You must be signed in to change notification settings - Fork 270
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include helpers in comments [feature request] #317
Comments
I'm not sure why this would be giving you problems. Plop treats all content in the template files the same, it has no concept of comments vs code. Can you provide an example of a template that doesn't render properly when run through plop? |
I was probably unclear: what i meant by "comment" is this: https://plopjs.com/documentation/#comments What we typically do is: plop.setGenerator('service', {
actions: [
{
base: 'templates/typescript',
destination: './{{dashCase name}}',
templateFiles: 'templates/typescript/**/*',
type: 'addMany',
},
'To start your server:',
' - cd {{dashCase name}}',
' - yarn install',
' - yarn start',
'',
],
prompts: [
{
message: 'Package name (will create a new directory)',
name: 'name',
type: 'input',
},
],
}); This issue is the string |
ah, I see... Yes, it would be possible to process this data through handlebars before it's printed to the terminal output. In the meantime, you could try using a Custom Action Function that simply returns the string you'd like to show. const instructions = (answers) => plop.renderString(`\
To start your server:
- cd {{dashCase name}}
- yarn install
- yarn start
`, answers);
plop.setGenerator('service', {
actions: [
{
base: 'templates/typescript',
destination: './{{dashCase name}}',
templateFiles: 'templates/typescript/**/*',
type: 'addMany',
},
instructions
],
prompts: [
{
message: 'Package name (will create a new directory)',
name: 'name',
type: 'input',
},
],
}); |
First off: amazing lib, incredibly useful 馃憦 馃挴
The only thing we're currently missing is to be able to use helpers in comments.
We're using Plop to make "create" packages. After the generator is done, we want to instruct users what to do next. It typically includes:
cd
into "that directory the generator just created"Currently including a comment with a helper (such as
"cd into {{dashCase name}}"
) will not execute the helper. Can plop also transform comment strings with helpers ?The text was updated successfully, but these errors were encountered: