Handlebars - what is handlebars.min.js about?

https://www.codecademy.com/courses/build-interactive-websites/lessons/learn-handlebars/exercises/handlebars-each-this-i
Hi, I am trying to understand how Handlebars works.
I found there this file - handlebars.min.js
What is this?
Thank you in advance!

The file contains the code for the Handlebars templating engine which is used in the exercise. It is a minified Javascript file to take less space and be faster to load (for example spaces, line breaks and comments have been removed). Therefore it is hard to read if you open it. The templating engine is used to dynamically render HTML (so that our HTML page will look different depending on the state of our program). It could for example be used with Node.js in a site where the HTML is rendered by the server (SSR).

1 Like

Hi Mike, Thank you for the fast answer.
Without this file (handlebars.min.js) our code does not work. Who writes this file - the last 3 rows. I am asking because I am able to write the html-index, css-style and js-main files (this particular exercise) but my code will not work still unless I add handlebars.min.js. And I am not able to do that.

There should be a line in your index.html file that loads the file. It should look something like this and will load up handlebars. Is that not working? If so, any particular error messages?

    <script src="handlebars.min.js"></script>

The handlebars file is written by the developers of Handlebars.js. Both the source-code and developers will show up if you search for handlebars.js on Github.

1 Like

Thank you very much Mike!
Found what you recommended. Looks complicated for a newbie.
Do you think Codecademy has built a “path” about it?

1 Like

Handlebars and some other templating engines are covered in some of the lessons on CC. It is a tool (out of many) that you may see in some tutorials so it’s good to know about. But there is definitely not any need to know how the source-code works in order to use it or be knowledgeable of all the details of this one tool. Web dev is definitely about using a lot of tools/libraries and making them work together so getting some exposure to a few of them is good even if not understanding them completely at the time. If you do front-end develepment, a library such as React will probably be your primary solution for combining data with html.

1 Like

Thank you very much again!

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.