【问题标题】:Has anyone gotten vue-cli and sass-loader to successfully import their CSS loaders on native? (vue-cli-plugin-nativescript-vue)有没有人让 vue-cli 和 sass-loader 在本机上成功导入他们的 CSS 加载器? (vue-cli-plugin-nativescript-vue)
【发布时间】:2020-09-17 14:12:48
【问题描述】:

我已经在我的 Nativescript-Vue / vue-cli@3.0 项目中设置了我的 vue.config.js 以自动将我的 global.scss 文件包含到我的 vue 模板中。在网络上服务时效果很好,但在我的本机模拟器上却不行。

运行 vue inspect (vue inspect -- --env.ios > out-ios.js) 我的 out-ios.js 显示 sass-loaders prependData: '$PLATFORM: ios;' 而不是 out-web.js 中出现的 @import "styles/global.scss";。我很好奇是否有人遇到过这个问题或解决了这个问题,因为我的想法已经用完了。

链接到我的 vue.config.js module.export:https://stackoverflow.com/a/62078502/3547640

【问题讨论】:

    标签: vue.js sass nativescript vue-cli-3 sass-loader


    【解决方案1】:

    如果有人在将 SCSS 文件导入其 nativescript vue 模板时遇到类似问题,请发布以供将来参考,我的解决方案涉及绝对路径和 vue-cli-plugin-sass-resources 插件。

    // vue.config.js
    module.exports = {
        pluginOptions: {
            sassResources: {
                resources: path.resolve(__dirname, './src/styles/global.scss'),
            },
        },
    }
    

    【讨论】:

      猜你喜欢
      • 2019-05-07
      • 2019-03-08
      • 2021-12-05
      • 2018-03-11
      • 2019-11-23
      • 2021-02-28
      • 1970-01-01
      • 2019-06-12
      • 2018-11-02
      相关资源
      最近更新 更多