webpack - VuePress:如何导入 css 框架(basscss)
问题描述
我正在尝试将basscss与VuePress项目一起使用,并且不确定如何在不直接引用 mode_modules 中的文件的情况下正确包含 basscss 文件,并且希望避免使用第三方 CDN。
到目前为止,我已经安装了带有 yarn 和一些 postcss 插件的 basscss 并制作了我自己的主题:
.vuepress
├── node_modules
├── package.json
└── theme
├── Layout.vue
└── styles
└── theme.styl
在我的config.js
:
module.exports = {
postcss: {
plugins: [
require('postcss-import')
]
}
...
}
在Layout.vue
:<style src="./styles/theme.styl" lang="stylus"></style>
在theme.style
,@import "basscss.css"
这会导致错误:
模块构建失败(来自 /Users/user/.config/yarn/global/node_modules/postcss-loader/lib/index.js):错误:在 [ /Users/user/code/project_title 中找不到“basscss.css” /.vuepress/theme/styles ]
使用标准的 webpack 模板很容易做到vue-cli
,但我在 VuePress 上苦苦挣扎,因为我不太熟悉 webpack 在这种特殊情况下的运作方式。
解决方案
推荐阅读
- c# - 具有相同密钥的项目已存在
- ruby-on-rails - 如何在 Heroku 上重置我的 HOST 环境变量?
- c++ - Visual Studio 2010 C/C++ 中 Windows 10 的清单(第 2 部分)
- javascript - User displayName validation with Firebase
- sql - 用前一行的值减去最近一行的值(第-1天)
- pandas - 如何将串行输出的结果转换回数据框?
- javascript - 如何创建固定的浮动加号按钮?
- json - 在 Elm 中,如何检测一组元素是否会丢失焦点?
- javascript - ReactJS -> 存储来自 promise 的变量
- lambda - Mapcar and Lambda, an undeclared variable error in LISP