将 style-sheet 导入 app.scss 以在整个项目中使用

importing style-sheet into app.scss to use throughout project

我想在我的应用程序中使用样式页面。

在我尝试使用的 app.scss 文件中:

@import "../global-scss/html-table-styles.scss";

这行不通。

将样式直接粘贴到 app.scss 文件中确实有效,但我不想那样做。

我正在努力实现的目标是否可行?如果可行,我做错了什么?

如果你的文件结构是这样的:

├── src
│   ├── app
│   │   ├── app.component.ts
│   │   ├── app.module.ts
│   │   ├── app.scss
│   │   └── main.ts

// ... pages, components ...

|   └── theme
│       ├── custom-styles.scss

...导入行应该是:

@import "../theme/custom-styles.scss";

问题是我对style-sheets的理解不够,因为已经有答案所以无法删除。

在我尝试导入的 style-sheet 中,我遵循了用于页面本地样式的模式并且有一个基本样式标签

例如:

html-table-styles{
//my styles
}

当我导入 @import "../global-scss/html-table-styles.scss"; 时,样式未被使用,删除 html-table-styles 解决了我的问题