vue.js - 如何在 NativeScript-Vue 中使用外部 scss 文件
问题描述
我有 2 个外部我想在我的Nativescript-Vue
文件中使用。
它们位于以下目录/app/styles/_variables.sccs
和/app/styles/generalStyles.scss
.
我_variables.sccs
在generalStyles.sccs
.
但是当我想generalStyles.sccs
在我的 Vue 文件中导入时,它给了我以下错误:
SassError:找不到或无法读取要导入的文件:样式/一般样式。在 app/components/Select/StationSelect.vue 的第 277 行
@import "样式/一般样式";
StationSelect.vue 看起来像这样
<style lang="scss" scoped>
@import "styles/generalStyles";
.routeDetailsChoice,
.timeDetails{
Label,
TextField{
.ns-dark &{
color: $white;
}
}
}
</style>
我还有以下软件包:
"nativescript-vue": "2.4.0",
"node-sass": "^4.13.0",
"sass-loader": "^8.0.1",
"style-loader": "^1.1.3",
解决方案
Webpack 配置了一些指向项目根文件夹的别名。尝试@import "app/styles/generalStyles";
或@import "~/styles/generalStyles";
从相对路径导入。
推荐阅读
- bash - 如何在 bash 中创建具有动态名称的数组
- mysql - 使用 WHERE...IN 更新多行
- ios - UICollectionViewFlowLayout、UICollectionView:更改屏幕方向会破坏单元格排列
- asp.net-mvc - MVC 项目间共享布局
- php - Laravel 5.7 - CSS 和 JS 不使用 URL::asset 加载
- c# - 文档 ID 和授权的 MongoDB 多租户数据库策略
- sql - SQL Server :“您的 SQL 语句的某些部分嵌套得太深。重写查询或将其分解为更小的查询。”
- docker - nginx 反向代理 docker 应用程序
- python - 使用子进程、Python 和 PSQL 进行多处理
- ios - 如何通过 Airdrop 发送和接收自定义数据