我正在尝试增强vue.js boilerplate code,我想与此一起使用flexboxgrid。我在package.json中添加了它并安装了它。我试图像这样在index.html
中包括它:
<link rel="stylesheet" href="/./node_modules/flexboxgrid/dist/flexboxgrid.min.css" type="text/css" >
但是我在浏览器中遇到以下错误:
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:8080/node_modules/flexboxgrid/dist/flexboxgrid.min.css".
我不确定执行此操作的正确方法,我在做什么拧,请帮助。
最佳答案
正如@ 1sloc在评论中提到的那样,您可能会在HTML中看到一个404错误页面。
直到找到更好的解决方案为止,您可以执行以下操作:将flexboxgrid.min.css
复制到项目根目录下的static
文件夹,然后从那里作为静态文件使用。这类似于您为应用程序提供favicon.ico
的方式。
有关处理静态文件的详细信息,您可以参考以下问题的答案:
How to set favicon.ico properly on vue.js webpack project?
关于javascript - 如何从节点模块添加新的CSS文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40290629/