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

nesting {{helper name}} within {} causes parsing error #56

Closed
michaelleone opened this issue Jun 25, 2018 · 6 comments
Closed

nesting {{helper name}} within {} causes parsing error #56

michaelleone opened this issue Jun 25, 2018 · 6 comments

Comments

@michaelleone
Copy link

G'day mate! Thanks for the insanely useful plugin, its awesome!

However I can't get the pascalHelper to add my filename as my CSS class name (CSS Modules), have pictured below. Any suggestions, did I miss something obvious? Appears to be an issue with nesting the helper moustache within another set of curly braces?

Cheers,

Mick

screen shot 2018-06-25 at 5 25 49 pm

screen shot 2018-06-25 at 5 26 01 pm

@michaelleone
Copy link
Author

michaelleone commented Jun 25, 2018

Hmmm, okay, it works with a space added after the helper moustache:

<div className={ styles.{{pascalCase name}} }>

I can live with that :)

@michaelleone
Copy link
Author

A suggestion! How about allowing use of VSCode user snippets in the template files? e.g. provide a placeholder for snippet names in the templates: {{snippetName: blahblah}}. That way the templates could be made as snippets including the curser positioning functions etc...

@michaelleone
Copy link
Author

Still an issue really... Adding a space before and after the enclosing curly braces does solve the parsing issue however it results in compiled format of className={ styles.FileName } which STANDARD Linting dislikes (and I agree):
screen shot 2018-06-29 at 1 32 02 pm

@reesemclean
Copy link
Owner

reesemclean commented Jun 29, 2018 via email

@michaelleone
Copy link
Author

michaelleone commented Jun 29, 2018 via email

@reesemclean
Copy link
Owner

reesemclean commented Jul 2, 2018

Here's the solution: http://handlebarsjs.com/expressions.html#whitespace-control

<div className={styles.{{pascalCase name~}} }>

☝️ should do it. The ~ tells it to remove the whitespace the tag is replaced! Gonna close this out.

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

No branches or pull requests

2 participants