janl / mustache.js

Minimal templating with {{mustaches}} in JavaScript

Home Page:https://mustache.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

<script src=???

JamesGiaquinto opened this issue · comments

Hi, I worked with mustaching on the PrairieLearn project, but I guess they had other code that shortcut connecting documents. I have the key:value dictionary in .json and I'm clear on how to "{{item}}</tag" set up the template. I still get an error telling me there is no reference for mustache.js or that it's not allowed.
I've looked for articles and tutorials but I'm just not getting the documents to find each other. I'm trying to find the script line to put in the or as src= but I'm just not making it work.
I thought it would be as easy as

<script src="https://raw.githubusercontent.com/janl/mustache.js/master/mustache.js"></script> Then I would go on to the html and add {{#catalog}}
    {{#items}}
  • {{name}}
  • {{/items}}
But, that's not working. It come out blank and console throws errors. I was able to use fetch() to get the .json data but that wasn't enough to make templating work.

What I want is to have all the html in .html and all the objects/data dictionary in .json. A lot of tutorials show how to just use the html file with javascript in it. Ok, I don't know how but it there is any way y'all can help me link the references together simply that would be great. I keep feeling like the answer must be right in front of my face but I can't see it. Ok, thanks for whatever help you can offer.