angular-cli - 如何在 `angular.json` 中配置内联样式和 html 模板?
问题描述
看起来所有教程都显示了如何以旧angular.cli.json
格式配置它。
"defaults": {
"styleExt": "css",
"component": {
"inlineStyle":true,
"inlineTemplate":true
}
}
但不是angular.json
格式。这就会产生错误Workspace needs to be loaded before it is used
那么我如何更改现有项目的配置以使用内联模板和 CSS/SCSS 生成组件
谢谢。
解决方案
在研究了angular CLI
命令并使用该设置生成一个新项目后,我使用了该解决方案:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"project-name": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"inlineTemplate": true,
"inlineStyle": true,
"styleext": "scss"
}
}, ....
}
推荐阅读
- node.js - Gmail 阻止 Nodemailer 发送邮件
- sql-server - 实体框架无法更新 SQL Server 数据库
- pyspark - Pyspark 字符串与 == 比较 RDkit 函数会引发错误
- powershell - 如何将 Azure DB 备份到本地磁盘?
- python - 使用数据相关的标记和颜色绘制 3d 散点图
- haskell - Haskell 函数 ["A","B"] [真,假]
- mysql - phpmyadmin:不同数据库中的 pma__ 表
- assembly - 如何使用 MARS/SPIM 系统调用在同一行打印数字和字符串?
- microservices - 与Kong相比,Krakend有多好?
- wordpress - 如何将我的网站从 cPanel 迁移到 Plesk?