javascript - 在聚合物中导入样式表
问题描述
我正在尝试从 Polymer 2.0 的库中导入样式表,虽然它在我的本地环境中工作,但当我将它部署到 firebase 托管时它失败了。这就是我所拥有的。
<!-- for the tree view of the lesson -->
<link rel="stylesheet" href="/node_modules/json-view/dist/jsonview.bundle.css" />
<dom-module id="my-admin-lesson-v2">
<template></template>
当我在 Firefox 中运行它时,我收到了这个错误(我在 Chrome 中没有看到它,但是 Chrome 稍后在我导入 .js 文件时失败了。所以在我看来类似的问题)。
The stylesheet https://c3do-classroom.web.app/node_modules/json-view/dist/jsonview.bundle.css was not loaded because its MIME type, “text/html”, is not “text/css”. admin-lesson-v2
看来该错误是由于 SPA 文件被导入并被视为 html 引起的,因为它在我的 index.html 文件中显示它失败。如何正确导入 css 和 js 文件?
解决方案
推荐阅读
- react-native - 如何使用 React-native 制作像 Instagram 一样的照片弹出窗口
- c++ - 如何编写可以获取 QString 或 std::string 的子字符串的模板函数?
- c# - 如何从 Coypu 获取 Selenium IWebDriver 和 IWebElement?
- ruby - 为什么 Struct/Class 实例的相等检查不同?
- ios - 手机锁定时如何从IOS上的网络应用程序连续播放音轨?
- javascript - 当按钮单击同一页面时,在引导模式中获取 id
- unity3d - Unity:双击按钮时如何制作定向破折号
- c# - 如何在布局中包装视图
在 Xamarin 表单中使用 DataTemplate 的控件 - amazon-web-services - Amazon EC2 和 Amazon Redshift 之间的关系
- bash - 为什么我的文本文件显示我的所有字段都等于只有一个字段?