=============== every time, save file, re-START server ==============
nodemon --exec npm start
npm install express-generator -g
express --view=pug myapp
nodemon can monitor file change and restart server
npm install -g nodemon
with express-pug, normally start server by
npm start
with Nodemon installed, I use
nodemon --exec npm start
Note:
nodemon app.js
will NOT work here,
because express.js use
start
script
============================================================
https://codepen.io/mimoduo/post/pug-js-cheat-sheet
Pug.js Cheat Sheet
https://codepen.io/mimoduo/post/pug-js-cheat-sheet
Includes
//- Include another pug file
include ./path-to/file.pug
//- Include other file types as plain text
include styles.css
include script.js
#Extends & Blocks
//- template.pug
block data
- var pageTitle = "Pugcupid"
html
head
title= pageTitle
body
block ribbon
block content
p Pugs fo life
//- page.pug
//- Extends template.pug
extends ./path-to/template.pug
block data
- var pageTitle = "Pudome"
block ribbon
p New pug jazz
block content
p This wipes out "Pugs fo life"
========================================================
var index = require('./routes/index');
No comments:
Post a Comment