-
Notifications
You must be signed in to change notification settings - Fork 29
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
globalJsonGlobbedTemplate templateData path fix #63
base: master
Are you sure you want to change the base?
Conversation
…ing the globbed template technique
…if so sets the correct path to itself
It might also be worth mentioning in the readme that when using paths this way the folder structure for the json must match the folder structure for the hbs Like so:
|
hey @mikemellor11!
I actually don't want that to be the case. I would want to change the implementation rather than change hte readme, because that should not be the case |
I figured it was the best of the three options i could think of: Option A - folder structure matches
Option B - single folder (no nesting)
Option C - mixture, structure has no relationship with matching
Option A means you have to match your folder structure hbs and json like i said, but really if your nesting your hbs for a reason then you'll probably want to do the same with your json. Option B means you can't have two json files with the same name also not being able to have folders might be a downside for some people. Option C means that if you do have two json files with the same name it would always use the first one it found which might cause bugs in peoples projects. I strongly! believe option A is the best solution here and its the current way people would interpret the behaviour as working. |
Thanks for figuring out this issue @mikemellor11 , it was driving me nuts trying to figure out why it wasn't working correctly. Looking forward to seeing it merged. |
bump, @patrickkettner any danger of this getting pulled in? I'd like to fix the issue #65 also when this ones sorted as it makes my console really bloated in certain projects and i've been meaning to fix it for a while. Thanks Mike |
Maybe i was unclear in my explanation of the readme edit, this pull request won't effect the readme as it is, you can leave it the same. However in it's current state the readme gives an impression that the plugin has functionality which it doesn't as seen in these issues - #60 #62 . This line of the readme -
Gives the impression the the templateData path can be set to something other than the same path that the plugin is looking for the handlebars files. In reality this currently isn't the case, you could set the grunt config to the following and it will make no difference:
The reason is it doesn't currently use the templateData at all it simply uses the handlebars path and changes the extension from hbs to json. My pull request simply allows you to specify a different path (or you can use the same path as before) and it will look in that location instead making the readme correct and the plugin to work as expected. |
#60 Fixed this issue regarding the templateData path, now does an iteration over all the globbed files and matches the right json to the right hbs and returns the result. Beforehand it was simply changing the extension from hbs to json meaning the hbs src was being used instead of the templateData path