【问题标题】:styleUrls ionic - 404 (Not Found)styleUrls 离子 - 404(未找到)
【发布时间】:2018-04-09 10:59:33
【问题描述】:

有谁知道如何解决在组件上找不到 .scss 的 404 文件:

这是我的 .ts 文件

我认为这就是您连接样式的方式 .scss 和 .ts 在同一个 calendar/ 目录中

@Component({
  selector: 'calendar',
  styleUrls: **['calendar.component.scss']**,
  templateUrl: 'calendar.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush
})

有没有其他人偶然发现这个问题。 我试过了:

styleUrls: ['calendar.component.scss'], styleUrls: ['./calendar.component.scss'], 还有:

在 app.scss 中,像这样:

@import '../components/calendar/calendar'
@import '../components/calendar/calendar/calender.component.scss'

所有尝试均不成功。有什么想法吗?

【问题讨论】:

  • Ionic 的哪个版本?通常,如果 scss 文件位于同名文件夹中,则不必指定指向该文件的链接。我会删除所有链接引用并检查它是否在名称/选择器方面匹配。'
  • 实际上删除链接有点适合我。谢谢@Aug
  • @Sampgun 很高兴能提供帮助。
  • 难道没有办法以 Angular 方式编译 SCSS 吗?我必须在 Ionic 中导入一个 Angular 5 应用程序,这让我抓狂。

标签: ionic-framework sass


【解决方案1】:

离子 4:

似乎实际的styleUrls 对于相对路径有点错误。 例如,将styleUrls 更改为styles

styles: ['favourites.scss'],

【讨论】:

    猜你喜欢
    • 2019-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-17
    • 2021-03-21
    相关资源
    最近更新 更多