I have templates that are mustache files that need to be converted to handlebars. From doing research it looks like handlebars supports a lot but not all of the mustache functionality. Are there any tools that will allow me to automate this conversion?
- Mustache:https://mustache.github.io/
- Handlebars: https://handlebarsjs.com/
- Here are some differences between mustache and handlebars: What are the differences between Mustache.js and Handlebars.js?
I am using these specific implementations of those templates:
- mustache: (Java) artifactId=jmustache https://github.com/samskivert/jmustache
- handlebars: (Java) artifactId=handlebars https://github.com/jknack/handlebars.java
CodePudding user response:
One can automate converting mustache templates to handlebars templates with this python mustache_to_handlebars
tool:
https://github.com/spacether/mustache_to_handlebars
One key differences is:
- #someTag in mustache covers these 3 use cases in handlebars: #if or #each or #with
And you can call it like:
mustache_to_handlebars path_containing_mustache_files