Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handlebars js editor.

Lately I have started to explore Ember.js, from their site I understood that there is a good synergy between Ember and Handlebars language.

I wondered if there is any editor (plugin) that can help me with handlebars auto-completion and coloring.

like image 252
Sergey Kucher Avatar asked Nov 13 '12 20:11

Sergey Kucher


People also ask

What is handlebars in Node JS?

Handlebars.js is a templating engine that makes it easy to separate your HTML from the code that powers it, enabling you to write cleaner code. Because of this, Handlebars is popular, especially when you don't want to use a standalone front-end framework.

What are the features of handlebars JavaScript-based front-end Dynamic HTML template libraries?

Today, I shall be discussing some basic features of handlebars JavaScript-based front-end dynamic HTML template libraries. Handlebars JavaScript is a client-side template engine that separates HTML from JavaScript in order to create dynamic HTML.

How do I use handlebars in it?

It uses a template and an input object to generate HTML or other text formats. Handlebars templates look like regular text with embedded Handlebars expressions. A handlebars expression is a { {, some contents, followed by a }}. When the template is executed, these expressions are replaced with values from an input object.

How to compile HTML templates with handlebars JavaScript?

Compile the template with handlebars JavaScript compile method. Provide the data context i.e. data from server-side in a form of JSON to map to the template. Insert or append the final HTML into your designated DOM location of the HTML page. You can follow step by step examples below or download below examples.


2 Answers

If you use Sublime Text 2, there is a great Handlebars package for syntax highlighting, etc.

https://github.com/nrw/sublime-text-handlebars

TextMate version:

https://github.com/drnic/Handlebars.tmbundle

It can be installed manually or with the Sublime Text 2 package manager.

like image 167
Marc Avatar answered Sep 23 '22 01:09

Marc


If you are using handlebars as .hbs files (no script tag) you can enable syntax highlight by configuring 2 settings: the editor and content types:

  • Eclipse -> Preferences -> General -> Content_Types
  • add *.hbs under html
  • Eclipse -> Preferences -> General -> Editor -> File Associations
  • Add *.hbs to html editor.
  • Close the editor and re-open it
  • [optional] If still not highlight (old eclipse versions) restart eclipse.

This works for aptana and zend studio as well

like image 45
Ignacio Vazquez Avatar answered Sep 23 '22 01:09

Ignacio Vazquez