How to render template

53 views
Skip to first unread message

Stian Øvrevåge

unread,
Jan 9, 2017, 5:04:23 PM1/9/17
to Nunjucks
Hi all, I'm unable to render even a basic template.

Here is my index.html:


<!DOCTYPE html>
<html>


<head>
   
<meta charset="utf-8">
   
<meta name="viewport" content="width=device-width, initial-scale=1.0">
   
<title>Stuff</title>
   
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
   
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Cookie">
   
<link rel="stylesheet" href="assets/css/dragula.css">
   
<link rel="stylesheet" href="assets/css/Pretty-Header.css">
   
<link rel="stylesheet" href="assets/css/styles.css">
</head>


<body>
   
<script src="assets/js/nunjucks.min.js"></script>
<script>
   
nunjucks
.configure('views', { autoescape: true });
nunjucks
.render('test.html', { foo: 'bar' });


</script>
   
<script src="assets/js/jquery.min.js"></script>
   
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
   
<script src="assets/js/dragula.js"></script>
   
<script src="assets/js/dragdrop.js"></script>
   
<script src="assets/js/nunjucks.min.js"></script>
</body>


</html>


And views/test.html contains

Custom Code

Using Chrome DevTools I can verify that all the script files are loaded, and test.html is also loaded and no errors are generated. Yet the page in the browser is completely blank. What am I missing? The documentation is pretty brief about any other dependencies or stuff that I maybe should have already known about.

Brgds,
Stian
Reply all
Reply to author
Forward
0 new messages