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
--partial and --helper glob issues #49
Comments
Hey @mdmoreau thanks for the issue. Can we get a bit more insight as to what your directory structure looks like? Maybe you could provide us with a repreduction? It is not clear to me what is happening here. |
@keithamus Absolutely! Here's a quick rundown of the project structure:
Calling helpers individually works fine: Breaks when calling as a glob: Quote/escape the helper glob: Happy to provide a demo repo if you think that would help. Sorry for the delayed response as well - had wrapped up the project using hbs-cli, and created the issue afterwards. Definitely plan on using it again in the future though. Thanks again for the help, and let me know if there's anything else I can do on my end. |
Calling with The quoted glob should "just work". Maybe could you run the command with |
Here's what I'm getting when running with debug:
This is using the following npm script:
If I remove the escaped quotes around the helper arg, it will work as long as there is only one helper in the glob. Anytime there is a second helper included that's actually used in a .hbs file, I get the following error:
The line right before the error |
@keithamus I setup a demo with the problem at https://github.com/mdmoreau/hbs-cli-demo. The quoted glob still isn't working in a helper for me, but when I call them individually it compiles correctly.
|
@mdmoreau I dont know if I'll be able to find the time to look into this soon, but I've put it on my todo list and will get round to it. I'll do my best though 😄 |
@keithamus Thanks! I don't mind helping out if you have any idea where the issue might be. |
Here's where the helpers get added: Line 163 in feacd1c
each Lines 38 to 40 in feacd1c
and here's the logic for that Lines 22 to 28 in feacd1c
Finally once all files are resolved they get given to Lines 57 to 60 in feacd1c
It is probably this part that is going wrong, looking at the debug output. I'd probably just scatter console logs in this function to see where things are going wrong, then investigate from there. I don't have an immediate hunch as to what is going wrong though. |
I ran into what seems like a strange problem on Ubuntu 18.04 when trying to add partials and helpers as globs. I typically double quote and escape any paths/globs in npm scripts to ensure Windows support, but when used with --helper I get an error saying the first helper file in the glob can't be found. The opposite is true for partials, where a glob only works if double quoted.
The following is what I used to get everything working correctly:
"hbs": "hbs \"src/hbs/*.hbs\" --output \"dist\" --helper ./src/hbs/util/*.js --partial \"./src/hbs/components/*.hbs\""
Do you know why helper might only work without quotes and partial only with quotes? If I pass each helper/partial individually, it didn't seem to matter if it is quoted or not.
Thanks for the great tool!
The text was updated successfully, but these errors were encountered: