Using angular-cli you can do this workaround.
- Install pug-cli using
npm install pug-cli --save-dev
. Now you are able to compile your .pug
files into .html
.
- Add a new
script
line into your package.json
's scripts: "puggy": "pug src -P -w"
. This will compile all your .pug
inside src
into .html
and starts watching them. Name of the task, of course, does not matter.
- Edit your
start
task, or create a new one, to first run puggy
and then serve
: "start" : "npm run puggy & ng serve"
.
Your package.json
should look like this:
"scripts": {
"ng": "ng",
"start" : "npm run puggy & ng serve",
"puggy": "pug src -P -w",
. . . other tasks
}
Now, simply run npm start
, or whatever name you gave to the task, in your terminal and you should see all of your .pug
files getting compiled/watched/rendered and then everything served up.
I suggest you to add all of your .html
files into your .gitignore
adding /src/**/*.html
into it and only pushing .pug
files to your repo. Make sure you remove cached .html
files using git rm --cached *.html
.
Now you'll be able to write a form like
form(novalidate, '#f'='ngForm', '(ngSubmit)'='onSignin(f)')
And compile it into it's html
<form novalidate="novalidate" #f="ngForm" (ngSubmit)="onSignin(f)"></form>