css - `JS: Error: Css styling failed: missing ' { nativescript-dev-sass 插件中的 '`

标签 css sass nativescript angular2-nativescript

安装 nativescript-dev-sass 插件后,我将/app 目录中的 app.css 文件重命名为 app.scss 以便我可以在其中编写 sass文件。 css 文件包含一个 import 语句,所以我将其更改为:

@import 'nativescript-theme-core/css/sky.css';

@import '~nativescript-theme-core/css/sky.css'; //notice the tilde

我正在使用此处 nativescript-dev-sass 存储库的自述文件中提到的波浪号:https://github.com/NativeScript/nativescript-dev-sass

当我运行 tns run android 时,我的应用程序启动时出现以下错误:

JS: Error: Css styling failed: Error: /data/data/io.myapp.app/files/app/app.css:1:97: missing '{'

app.scss 编译得到的 app.css 文件有以下行:

@import url(C:\my_workspace\myapp\node_modules\nativescript-theme-core\css\sky.css)

该行的第 97 列,如错误消息中所指定,是紧跟在右括号 ) 之后的那一列,实际上不应该有 {。所以我不知道为什么它说缺少 {。

我该怎么做才能解决这个问题?

最佳答案

可能是你需要使用

@import '~nativescript-theme-core/scss/sky';  // #theme variables

代替

@import '~nativescript-theme-core/css/sky.css'; //notice the tilde

关于css - `JS: Error: Css styling failed: missing ' { nativescript-dev-sass 插件中的 '`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46551234/

相关文章:

android - 如何在 Android 上使用 NativeScript 和 Angular 更改 StatusBar 颜色或将其设置为透明?

HTML 文本未显示在图像上

javascript - JQuery 日期选择器与自定义日期选择器

html - 如何首先放置 ionic 标签?

css - 通过变量逐渐改变颜色

css - 无法在 NativeScript 中使用字体图标

jquery - 区域标签上的背景图像

javascript - 通过 javascript/jquery 将类/id 添加到包含特定文本的 div

css - 无法更改背景颜色且找不到元素

android - 从 Azure DevOps 部署到 Google Play 商店时出现错误 "APK specifies a version code that has already been used.."