@angular/cli: 1.4.1 Angular 生成组件但是它 returns home.component.css
@angular/cli: 1.4.1 Angular Generate Component but it returns home.component.css
$npm install -g @angular/cli
$ng new angular --routing --style=sass
$ng g c home
"apps": [
{
"styles": [
"styles.sass"
],
}
"defaults": {
"styleExt": "sass",
"component": {
}
}
我想在 angular 中使用 sass 样式,我使用 angular cli,我尝试使用带有前缀 css 的样式生成组件 returns .你能帮我解决这个问题吗?预先感谢您的回答。
要覆盖默认样式,您可以使用选项 --style [css|scss|sass]
:
ng g c home --style=css
这是我的默认设置:
"defaults": {
"styleExt": "scss",
"prefixInterfaces": false,
"inline": {
"style": false,
"template": false
},
"spec": {
"class": false,
"component": true,
"directive": true,
"module": false,
"pipe": true,
"service": true
}
}
否则,您可以重命名它。
我刚从 @angular/cli@1.0.3
迁移到 @angular/cli@1.4.2
,我遇到了同样的问题。原来这是由于 v1.4.1 中引入的错误,所以我们只能等待新的 angular-cli 版本来修复此错误。
在 v1.4.1 中,apps.prefix
也被忽略,但这在 v1.4.2 中已修复。
同时,可以使用@Derlin提供的解决方法。
github 个关于此主题的问题:
- https://github.com/angular/angular-cli/issues/7624
- https://github.com/angular/angular-cli/issues/7682
- https://github.com/angular/angular-cli/issues/7644
- https://github.com/angular/angular-cli/issues/7647
- https://github.com/angular/angular-cli/issues/7522
更新:
此问题已在 @angular/cli@1.4.3
中修复。检查 this release note.
@angular/cli: Generating component considers default style extension
for project now
$npm install -g @angular/cli
$ng new angular --routing --style=sass
$ng g c home
"apps": [
{
"styles": [
"styles.sass"
],
}
"defaults": {
"styleExt": "sass",
"component": {
}
}
我想在 angular 中使用 sass 样式,我使用 angular cli,我尝试使用带有前缀 css 的样式生成组件 returns .你能帮我解决这个问题吗?预先感谢您的回答。
要覆盖默认样式,您可以使用选项 --style [css|scss|sass]
:
ng g c home --style=css
这是我的默认设置:
"defaults": {
"styleExt": "scss",
"prefixInterfaces": false,
"inline": {
"style": false,
"template": false
},
"spec": {
"class": false,
"component": true,
"directive": true,
"module": false,
"pipe": true,
"service": true
}
}
否则,您可以重命名它。
我刚从 @angular/cli@1.0.3
迁移到 @angular/cli@1.4.2
,我遇到了同样的问题。原来这是由于 v1.4.1 中引入的错误,所以我们只能等待新的 angular-cli 版本来修复此错误。
在 v1.4.1 中,apps.prefix
也被忽略,但这在 v1.4.2 中已修复。
同时,可以使用@Derlin提供的解决方法。
github 个关于此主题的问题:
- https://github.com/angular/angular-cli/issues/7624
- https://github.com/angular/angular-cli/issues/7682
- https://github.com/angular/angular-cli/issues/7644
- https://github.com/angular/angular-cli/issues/7647
- https://github.com/angular/angular-cli/issues/7522
更新:
此问题已在 @angular/cli@1.4.3
中修复。检查 this release note.
@angular/cli: Generating component considers default style extension for project now