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

How Can you add helper functions? #5

Open
doodoroma opened this issue Jan 11, 2018 · 10 comments
Open

How Can you add helper functions? #5

doodoroma opened this issue Jan 11, 2018 · 10 comments

Comments

@doodoroma
Copy link

No description provided.

@markbjerke
Copy link

I have the same issue?

@chaliy
Copy link
Owner

chaliy commented Feb 3, 2018

Not sure I understand. Could you please provide an example?

@neurospeech
Copy link

neurospeech commented Feb 23, 2018

@chaliy Example is using handlebars-intl library and adding other custom javascript directives ..

I would recommend using default _preview_handlebars.js which allows us to include custom javascript with dependent modules.

@alexeykirdin
Copy link

Hello, chaliy!

Thanks for plug-in.
Custom helpers support needed.
Can you add some option to add JS file with helpers to handle code like:

  {{#compare @key "==" "NONE"}}
    <p>Some text here for NONE</p>
  {{/compare}}

...
and many other cases like:
http://doginthehat.com.au/2012/02/comparison-block-helper-for-handlebars-templates/

@anonimitoraf
Copy link

anonimitoraf commented Dec 7, 2018

If no one's looking at this, might try implementing when I get some time. I'm thinking, along with the my-file.hbs.json file, the helper functions can be defined in my-file.hbs.js

@anonimitoraf
Copy link

anonimitoraf commented Dec 8, 2018

See PR #9

@DanTalash
Copy link

This would be very useful for us. We're trying to use this for working with our templates which are using custom helper functions, and are otherwise blocked by not being able to add the functions in the extension.

I see that there is a PR above, but it was never merged and is now out of date. Will this ever be a feature?

@anonimitoraf
Copy link

Hey @DanTalash, can you try if my version of the extension works for you? https://marketplace.visualstudio.com/items?itemName=anonimitoraf.handlebars-preview-with-function-support

@DanTalash
Copy link

DanTalash commented Nov 30, 2022

Hi @anonimitoraf,

I tried switching to your version of the extension. It took a few attempts, but I was able to finally stop the preview throwing errors for our functions. Thank you, this should be useful.

I will try using it to see if there are other blocking issues, but my first note would be that the preview doesn't seem to auto-refresh. I need to close and reopen it to see any changes reflected. I would make an issue on your repo, but it doesn't appear that issues are enabled.

@cyqsimon
Copy link

cyqsimon commented Dec 9, 2022

If you need something that works right now, you may want to take a look at this alternative. I tried it and it works quite well.

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

7 participants