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

globalJsonGlobbedTemplate - templateData path doesn't actually matter #60

Open
mikemellor11 opened this issue Nov 23, 2015 · 6 comments

Comments

@mikemellor11
Copy link

From what i've found setting the path in templateData when using the globalJsonGlobbedTemplate technique doesn't actually change anything, it looks in the same place you've set it to find the handlebars/html files. This behaviour is fine, but it might be helpful to set the templateData to '*.json' in the readme as this is all thats needed for it to work.

@patrickkettner
Copy link
Owner

could you post a demo of the unexpected behavior? I am not replicating.

@ch2ch3
Copy link

ch2ch3 commented Jan 27, 2016

@patrickkettner I'm having the same problem. In my Gruntfile I've set templateData: './templates/data/*.json', but running my task with -v gives the following output:

Reading ./templates/pages/index.hbs...OK
Reading ./templates/pages/index.json...ERROR
OK
Reading ./templates/pages/join-us.hbs...OK
Reading ./templates/pages/join-us.json...ERROR
OK
Reading ./templates/pages/press.hbs...OK
Reading ./templates/pages/press.json...ERROR
OK
Reading ./templates/pages/privacy.hbs...OK
Reading ./templates/pages/privacy.json...ERROR
OK
Reading ./templates/pages/terms-and-conditions.hbs...OK
Reading ./templates/pages/terms-and-conditions.json...ERROR
OK

It's not looking in the directory I've defined but in the directory where it's reading the templates from.

@ghost
Copy link

ghost commented Feb 1, 2016

This works for me.

   build: {
        files: [{
            cwd : '_handlebars',
            expand: true,
            src: [ '*.handlebars' ],
            dest: '_dist/',
            ext: '.html'
        }],
        templateData: '*.json',
        helpers: '_handlebars/helpers/*.js'
    }   

@mikemellor11
Copy link
Author

Yeah that will work fine, the point i'm making is that if you set a path for templateData it will get ignored and continue to look where the handlebar/html files are, so either change the readme to reflect that or we can look at changing the implementation.

@patrickkettner
Copy link
Owner

the implementation should definitely be changed - the readme reflects what should be happening.

@mikemellor11
Copy link
Author

I've added a failing test case that displays the issue, i'll try and take a whack at fixing it later if i get a chance. Feel free to take a look for the time being - https://github.com/mikemellor11/grunt-compile-handlebars.git

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

3 participants