[英]React/CSS: Using CSS stylesheets in a React app?
I have normal css file I would like to use in my React app which is not using webpack. 我有我想在不使用webpack的React应用中使用的普通CSS文件。 When I try to import the css file, I get the below error: 当我尝试导入css文件时,出现以下错误:
Module parse failed: Unexpected character '@' (1:0)
You may need an appropriate loader to handle this file type.
> @import url("https://fonts.googleapis.com/css?family=Ubuntu:400,400i,700,700i");
Based on some posts that I have seen online, it looks like you have to webpack and customize it to load the css stylesheet. 根据我在网上看到的一些帖子,您似乎必须打包并自定义它才能加载CSS样式表。 But is there a way to use my existing stylesheet without webpack ? 但是有没有办法在没有webpack的情况下使用现有样式表吗?
您可以在index.html
的<head>
之间添加以下行...
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu:400,400i,700,700i">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.