Iris: RegisterView error

Created on 19 Aug 2018  ·  2Comments  ·  Source: kataras/iris

i tried to registerView under a folder and there is an html with the mustache syntax on it and it does compile in go and got the following error.
"
[ERRO] 2018/08/19 16:25 view: template: 200.html:4: function "dsd" not defined
"
The html is compiled from vue cli.

html

<!DOCTYPE html>
<html data-n-head="">
  <head>
    <meta data-n-head="true" charset="utf-8"/><meta data-n-head="true" name="viewport" content="width=device-width, initial-scale=1"/><meta data-n-head="true" data-hid="description" name="description" content="{{dsd }}"/><title data-n-head="true">{{ name }}</title><link data-n-head="true" rel="icon" type="image/x-icon" href="/favicon.ico"/><link rel="preload" href="/_nuxt/manifest.a6a38ec8ba44258f0937.js" as="script" /><link rel="preload" href="/_nuxt/vendor.968d33e1f0e3df60b292.js" as="script" /><link rel="preload" href="/_nuxt/app.8a68a0008bc7b2732755.js" as="script" /><link rel="prefetch" href="/_nuxt/pages/play.23f600d76e6bda4ce2ac.js" /><link rel="prefetch" href="/_nuxt/pages/index.5d2503e06943835fc4fe.js" /><link rel="prefetch" href="/_nuxt/layouts/default.f802211377c728d555bc.js" />
  </head>
  <body data-n-head="">
    <div id="__nuxt"><style>body, html, #__nuxt {  background-color: white;  width: 100%;  height: 100%;  display: flex;  justify-content: center;  align-items: center;  margin: 0;  padding: 0;}.spinner {  width: 40px;  height: 40px;  margin: 100px auto;  background-color: #dbe1ec;  border-radius: 100%;  -webkit-animation: sk-scaleout 1.0s infinite ease-in-out;  animation: sk-scaleout 1.0s infinite ease-in-out;}@-webkit-keyframes sk-scaleout {  0% { -webkit-transform: scale(0) }  100% {    -webkit-transform: scale(1.0);    opacity: 0;  }}@keyframes sk-scaleout {  0% {    -webkit-transform: scale(0);    transform: scale(0);  } 100% {    -webkit-transform: scale(1.0);    transform: scale(1.0);    opacity: 0;  }}</style><div class="spinner">  <div class="double-bounce1"></div>  <div class="double-bounce2"></div></div><!-- http://tobiasahlin.com/spinkit --></div>
  <script type="text/javascript" src="/_nuxt/manifest.a6a38ec8ba44258f0937.js"></script><script type="text/javascript" src="/_nuxt/vendor.968d33e1f0e3df60b292.js"></script><script type="text/javascript" src="/_nuxt/app.8a68a0008bc7b2732755.js"></script></body>
</html>

question

Most helpful comment

@kataras this is helpful!

All 2 comments

@jjhesk Although you didn't show us the Go code, I supose that you are using the standard html/template engine, the iris.HTML(). That go template engine uses the {{ and }} as char delims which conflicts. You have to change the template delims, you can do that with the Delims func:

app := iris.New()

view := iris.HTML("./templates", ".html")
view.Delims(left, right string)

app.RegisterView(view)

Thanks,
Gerasimos Maropoulos

@kataras this is helpful!

Was this page helpful?
0 / 5 - 0 ratings