mirror of
https://github.com/kataras/iris.git
synced 2026-01-10 05:25:58 +00:00
Update vendor for Pug (Jade) Parser and add Iris + Pug examples in the _examples/view folder, relative to https://github.com/kataras/iris/issues/1003
Former-commit-id: e26a5701e00ec055f3bcf693c1980c7d22147310
This commit is contained in:
20
_examples/view/template_pug_3/main.go
Normal file
20
_examples/view/template_pug_3/main.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import "github.com/kataras/iris"
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
|
||||
tmpl := iris.Pug("./templates", ".pug")
|
||||
|
||||
app.RegisterView(tmpl)
|
||||
|
||||
app.Get("/", index)
|
||||
|
||||
// http://localhost:8080
|
||||
app.Run(iris.Addr(":8080"))
|
||||
}
|
||||
|
||||
func index(ctx iris.Context) {
|
||||
ctx.View("index.pug")
|
||||
}
|
||||
7
_examples/view/template_pug_3/templates/index.pug
Normal file
7
_examples/view/template_pug_3/templates/index.pug
Normal file
@@ -0,0 +1,7 @@
|
||||
extends templates/layout.pug
|
||||
|
||||
block title
|
||||
title Article Title
|
||||
|
||||
block content
|
||||
h1 My Article
|
||||
7
_examples/view/template_pug_3/templates/layout.pug
Normal file
7
_examples/view/template_pug_3/templates/layout.pug
Normal file
@@ -0,0 +1,7 @@
|
||||
doctype html
|
||||
html
|
||||
head
|
||||
block title
|
||||
title Default title
|
||||
body
|
||||
block content
|
||||
Reference in New Issue
Block a user