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

Precompiler Issue?? #734

Closed
OAFCROB opened this issue Feb 12, 2014 · 14 comments
Closed

Precompiler Issue?? #734

OAFCROB opened this issue Feb 12, 2014 · 14 comments

Comments

@OAFCROB
Copy link

OAFCROB commented Feb 12, 2014

First I'm using the following;

  • jquery-1.10.1.min.js
  • jquery.mobile-1.3.1.min.js
  • handlebars.runtime-v1.3.0.js

I have created a simple template called it "footer.handlebars" passed it into the CLI compiler with the following command;

handlebars footer.handlebars -f footer.template.js -m

I then include the footer.template.js after the handlebars itself and have a call to the template as follows;

var data = {
productType: 'APP',
appName : 'Test',
appVersion : '1.0',
currentYear: new Date().getFullYear()
};

var template = Handlebars.templates.footer(data);
$("#footerContainer").html(template);

This is bound to the document.ready command of jQuery and there is the containing div footerContainer for the template to populate into.

At run time I get the following error;

TypeError: Object # has no method 'call' at line 436 http://localhost/scripts/lib/handlebars.runtime-v1.3.0.js

First of all I'm not sure if I have done something wrong, so it could be human error. Or whether there is a known bug with the version of jQuery or handlebars etc...

@r3to
Copy link

r3to commented Feb 12, 2014

Hi
I had a similar problem. downgrading the CLI compiler to version 1.3 (was 2.0.0-alpha.1) did help

npm uninstall handlebars -g
npm install handlebars@1.3 -g

@20pro
Copy link

20pro commented Feb 12, 2014

Hi,
i have similar problem. I downgrading the CLI compiler to version 1.3 but when i generate template i have this error

Uncaught TypeError: Property 'template' of object [object Object] is not a function

Help me please ?
How do I generate a template to version 1.3 ??

@OAFCROB
Copy link
Author

OAFCROB commented Feb 12, 2014

Thanks r3to that worked perfectly.

I did as you said, recompiled the file and switched to the run time handlebars. To find out it all works!!

Some needs to amend the handlebars website to accommodate for this is as I think it would be a fairly common issue.

@OAFCROB OAFCROB closed this as completed Feb 12, 2014
@20pro
Copy link

20pro commented Feb 12, 2014

Hi OAFCROB , can you help me please ??

@OAFCROB
Copy link
Author

OAFCROB commented Feb 12, 2014

Yes, what's the problem?

Firstly have you seen handlebars build your template in the normal format?

If so have you got the runtime version downloadable from;

http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars.runtime-v1.3.0.js

Have you got node.js installed and the compiler installed as r3to stated?

Build the precompiled file via CLI by changing into the directory of the file i.e /pages

Then run, remembering to replace your files between the << and >> but don't include them

handlebars <> -f <> -m

Hit return you should see the new file in the directory.

Now include this into the header tags i.e.

<script type="text/javascript" src="/scripts/lib/handlebars.runtime-v1.3.0.js"></script> <script type="text/javascript" src="/pages/footer.template.js"></script>

Then on document.ready or what have you, put something on the lines of;

var data = {
productType: 'APP',
appName : 'Test',
appVersion : '1.0',
currentYear: new Date().getFullYear()
};

var template = Handlebars.templates.footer(data);
$("#footerContainer").html(template);

@20pro
Copy link

20pro commented Feb 12, 2014

Thank's
I installed handlebars today with command : npm install handlebars -g
and it install version 2.0.0-alpha.1.
I downgrading the CLI compiler to version 1.3 but when i generate template i have this error

Uncaught TypeError: Property 'template' of object [object Object] is not a function

When I execute the following line , this result is :

(function() {
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
})();

My version of handlebars and handlebars.runtime is 1.3.0

@OAFCROB
Copy link
Author

OAFCROB commented Feb 12, 2014

Updated my previous comment, a little step by step guide to how I did

@20pro
Copy link

20pro commented Feb 12, 2014

thank's
can i see file that generate by CLI compiler please ?

@OAFCROB
Copy link
Author

OAFCROB commented Feb 12, 2014

You should be able to find it within the folder you changed to.

@20pro
Copy link

20pro commented Feb 12, 2014

thank's ;)

@OAFCROB
Copy link
Author

OAFCROB commented Feb 12, 2014

Glad I could help :-D

@Rajesh-jai
Copy link

i installed handlebar using >> npm uninstall handlebars -g
it shows version 2.0.0-alpha.1.
i am using ubuntu system. i need version 1.0.6. please anyone help me to get 1.0.6 version.

@OAFCROB
Copy link
Author

OAFCROB commented Feb 19, 2014

npm uninstall handlebars -g
npm install handlebars@1.0.6 -g

@Rajesh-jai
Copy link

Thanks OAFCROB

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

4 participants