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

Template literals (Template strings) Failing To Process #132

Open
ronnievsmith opened this issue Nov 2, 2022 · 3 comments
Open

Template literals (Template strings) Failing To Process #132

ronnievsmith opened this issue Nov 2, 2022 · 3 comments

Comments

@ronnievsmith
Copy link

Are template strings supported? I am getting the following error from Grunt:

Fatal error: myTemplateStringVar is not defined

My variable looks like below and runs fine in all three major web browsers.

myTemplateStringVar = "xyz";
let thisDt = fragment.querySelector(`dt[data-label=${myTemplateStringVar}]`);
@dciccale
Copy link
Owner

dciccale commented Nov 2, 2022

Hi @ronnieroyston template strings or string interpolation with backticks, is a javascript feature and it has nothing to do with this plugin or grunt.

There is nothing wrong in the code example you shared. I would need more context on where are you running this code specifically to understand what is it that is failing. something I can reproduce

@ronnievsmith
Copy link
Author

Thanks for the response Denis. When I remove the newly added template string lines of code the files get built with Grunt. It's a large js file.

The error message was:

Running "processhtml:dist" (processhtml) task
Fatal error: myTemplateStringVar is not defined

@dciccale
Copy link
Owner

dciccale commented Nov 3, 2022

make sure the variable is available in the scope you're using it. i can't help you much more than that without some example. it seems more like a javascript mistake on your code rather than an issue with this particular plugin, I could be wrong but without something to reproduce it is very hard for me to help.
if i can get some time later I can make a demo/test to show how variables actually should work fine. but i don't know where are you using that code, is it in your gruntfile or where?

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