Utilizing the capabilities of angular-cli, you can implement this solution.
Your package.json
file should resemble the following:
"scripts": {
"ng": "ng",
"start" : "npm run puggy & ng serve",
"puggy": "pug src -P -w",
. . . additional tasks
}
To observe the results, simply execute npm start
(or whichever custom task title you opted for) in your terminal. You'll witness the compilation, monitoring, rendering, and serving of all your .pug
files.
As a recommendation, include all generated .html
files in your .gitignore
using /src/**/*.html
, ensuring only .pug
files are pushed to your repository. Eliminate cached .html
files with git rm --cached *.html
.
With this setup, crafting a form like below becomes effortless:
form(novalidate, '#f'='ngForm', '(ngSubmit)'='onSignin(f)')
Which translates to the following HTML upon compilation:
<form novalidate="novalidate" #f="ngForm" (ngSubmit)="onSignin(f)"></form>