Pug Template Engine

Aus Wikizone
Wechseln zu: Navigation, Suche

Siehe auch Jade Template Engine

Jade ist der Vorgäner. Aus rechtlichen Gründen wurde Jade umbenannt. Pug hat aber auch einige Veränderungen erfahren.

Links

https://pugjs.org
https://github.com/pugjs/pug-cli (Command Line Interface)
https://codeburst.io/getting-started-with-pug-template-engine-e49cfa291e33

Installation

Eventuell mit sudo davor

npm install --global pug

und das Command Line Interface bei neueren Versionen (sonst gehts nur über das Package.json File)

npm install pug-cli -g

Beispiele

Einsatz mit NodeJS

Package.json

 ...
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "sass-compile": "node-sass --include-path sass scss/styles.sass css/styles.css",
    "sass-compile-folder": "node-sass scss/ -o css/",
    "sass-watch": "node-sass --watch --include-path sass scss/styles.sass css/styles.css",
    "sass-watch-folder": "node-sass --watch scss -o css",
    "pug-watch": "pug -w templates/ --out ./",
    "start": "npm run sass-watch | npm run pug-watch"
 ...
  },