@ angular/cli:1.4.1 Angular生成组件,但它返回home.component.css [英] @angular/cli: 1.4.1 Angular Generate Component but it returns home.component.css

查看:50
本文介绍了@ angular/cli:1.4.1 Angular生成组件,但它返回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": {
    }
  }

我想用尖锐的方式骚扰样式,我使用尖角的cli,我尝试生成以前缀css为样式返回的组件.您能帮我解决这个问题吗?预先感谢您的回答.

I want to sass style in angular, I use angular cli, I try to generate component it returns with style with prefix css. May you help me to fixing that? Thanks in advance for your answer.

推荐答案

我刚刚从@angular/cli@1.0.3迁移到了@angular/cli@1.4.2,并且遇到了同样的问题.原来是由于v1.4.1中引入了一个错误,所以我们只能等待一个新的angular-cli版本来解决此错误. 在v1.4.1中,apps.prefix也被忽略,但在v1.4.2中已修复.

I just migrated from @angular/cli@1.0.3 to @angular/cli@1.4.2 and I am facing the same issue. Turns out it's due to a bug introduced in v1.4.1 so we can only wait for a new angular-cli release that will fix this bug. In v1.4.1 also the apps.prefix is ignored but this was fixed in v1.4.2.

同时,可以使用@Derlin提供的解决方法.

In the mean time, the workaround provided by @Derlin can be used.

有关此主题的github问题:

github issues on this topic:

  • 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中修复.查看此发行说明.

The issue is fixed in @angular/cli@1.4.3. Check this release note.

@ angular/cli:生成组件考虑默认样式扩展 现在进行项目

@angular/cli: Generating component considers default style extension for project now

这篇关于@ angular/cli:1.4.1 Angular生成组件,但它返回home.component.css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆