mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-27 14:54:05 -06:00
vault backup: 2022-09-21 13:24:30
This commit is contained in:
parent
94ac98d536
commit
62a25de2c8
@ -1,28 +0,0 @@
|
||||
---
|
||||
title: "11-mvc-model"
|
||||
aliases:
|
||||
tags:
|
||||
- cosc203
|
||||
- lecture
|
||||
---
|
||||
|
||||

|
||||
|
||||
# view templates
|
||||
## pug
|
||||
pug is a view engine.
|
||||
``` js
|
||||
app.set('views', path.join(__dirname, 'views'))
|
||||
app.set('view engine', 'pug')
|
||||
```
|
||||
|
||||
a pug file
|
||||
- defines an html template
|
||||
|
||||
e.g.,
|
||||
``` pug
|
||||
doctype html
|
||||
head
|
||||
title mytitle
|
||||
script(type="text/javascript")
|
||||
```
|
||||
44
content/notes/11-view-templates.md
Normal file
44
content/notes/11-view-templates.md
Normal file
@ -0,0 +1,44 @@
|
||||
---
|
||||
title: "11-view-templates"
|
||||
aliases:
|
||||
tags:
|
||||
- cosc203
|
||||
- lecture
|
||||
sr-due: 2022-09-24
|
||||
sr-interval: 3
|
||||
sr-ease: 250
|
||||
---
|
||||
|
||||
[slides](https://blackboard.otago.ac.nz/bbcswebdav/pid-2972656-dt-content-rid-19051721_1/courses/COSC203_S2DNI_2022/COSC203_lecture11.pdf)
|
||||
|
||||

|
||||
|
||||
# view templates
|
||||
## pug
|
||||
pug is a view engine.
|
||||
``` js
|
||||
app.set('views', path.join(__dirname, 'views'))
|
||||
app.set('view engine', 'pug')
|
||||
```
|
||||
|
||||
a pug file
|
||||
- defines an html template
|
||||
|
||||
e.g.,
|
||||
```
|
||||
doctype html
|
||||
head
|
||||
title Pug
|
||||
script(type= "text/javascript").
|
||||
if (foo) bar(1 + 5)
|
||||
body
|
||||
h1 Pug - node template engine
|
||||
#container.col //auto makes div with classs
|
||||
p You are amazing
|
||||
p Pug is a terse and simple templating language.
|
||||
```
|
||||
|
||||
### extending views
|
||||
- you can declare a base template and then extend it, replacing jus the bits you want to change
|
||||
|
||||

|
||||
@ -34,6 +34,7 @@ tags:
|
||||
- [08-web-frameworks](notes/08-web-frameworks.md)
|
||||
- [09-web-databases-networks](notes/09-web-databases-networks.md)
|
||||
- [10-routes-controllers](notes/10-routes-controllers.md)
|
||||
- [11-view-templates](notes/11-view-templates.md)
|
||||
|
||||
# Archive
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user