【发布时间】:2018-11-13 22:47:33
【问题描述】:
是否可以将常见样式与配置特定样式结合起来?或者具体来说,构建具有多个配置的应用?
我有一个应用程序,它根据构建期间使用的配置使用不同的材料主题。这是应用程序 angular.json 的 build 部分的样子:
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/my-app",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"scripts": [ ],
"styles": [
// These are the common styles
"src/styles.scss"
],
"assets": [
"src/assets",
"src/favicon.ico"
]
},
"configurations": {
"theme-one": {
"styles": [
"src/styles/themes/material.theme-one.scss"
]
},
"theme-two": {
"styles": [
"src/styles/themes/material.theme-two.scss"
]
}
}
},
▶ 预期行为:
我想添加/组合单个配置中指定的 styles 以及 build:options 中指定的 styles .例如,使用以下命令:
ng build --configuration theme-one
上述命令应包括"src/styles.scss"和"src/styles/themes/material.theme-one.scss"。 theme-two 也一样。
▶ 当前行为:
当前的行为是,当我指定配置时,该配置中的 styles 被包括在内,但 build:options:styles 被忽略。
知道如何实现这一目标吗?
【问题讨论】:
标签: angular angular-cli angular6 angular-cli-v6