Angular4 中使用Pug/Jade

来源:互联网 发布:mfc编程实例 2008 编辑:程序博客网 时间:2024/05/17 22:34

1、安装相应loader :
pug-html-loaderpug

npm i pug pug-html-loader -S

2、修改 node_modules\@angular\cli\models\webpack-configs\common.js文件,在loader中添加:

 {         test: /\.pug$/,         loaders: [          'html-loader', {          loader: 'pug-html-loader',            options: {              doctype: 'html'            }          }        ]      }

3、这时候就能这样写Angular了:

@Component({  selector: 'app-my-header',  templateUrl: './my-header.component.pug',  styleUrls: ['./my-header.component.css']})