Javascript 反应+;反应突出。代码高亮
我正在使用react with meteor和react highlight。问题是我的代码没有突出显示,我在控制台上遇到了这个错误Javascript 反应+;反应突出。代码高亮,javascript,meteor,reactjs,Javascript,Meteor,Reactjs,我正在使用react with meteor和react highlight。问题是我的代码没有突出显示,我在控制台上遇到了这个错误 资源被解释为样式表,但使用MIME类型text/html传输:http://localhost:3000/singlearticle/node_modules/highlight.js/styles/tomorrow.css“ 这意味着什么?我应该怎么做?您可以从meteor client文件夹中的“/node\u modules/highlight.js/sty
资源被解释为样式表,但使用MIME类型text/html传输:http://localhost:3000/singlearticle/node_modules/highlight.js/styles/tomorrow.css“
这意味着什么?我应该怎么做?您可以从meteor client文件夹中的“/node\u modules/highlight.js/styles/tomory.css”中删除css文件tomory.css,它将自动添加到您的项目中 或 在jsx文件上,您可以按如下方式导入它:
import React, { Component } from 'react';
import Highlight from 'react-highlight';
import "../node_modules/highlight.js/styles/tomorrow.css";
export default class App extends Component {
render() {
return (
<div className="container">
<header>
<h1>Example</h1>
</header>
<Highlight className='js'>{"var test = 'hello'"}</Highlight>
</div>
);
}
}
import React,{Component}来自'React';
从“反应高光”导入高光;
导入“./node_modules/highlight.js/styles/tomory.css”;
导出默认类应用程序扩展组件{
render(){
返回(
例子
{“var test='hello'”}
);
}
}
您只需从meteor client文件夹中的“/node\u modules/highlight.js/styles/tomory.css”中删除css文件tomory.css,它将自动添加到您的项目中
或
在jsx文件上,您可以按如下方式导入它:
import React, { Component } from 'react';
import Highlight from 'react-highlight';
import "../node_modules/highlight.js/styles/tomorrow.css";
export default class App extends Component {
render() {
return (
<div className="container">
<header>
<h1>Example</h1>
</header>
<Highlight className='js'>{"var test = 'hello'"}</Highlight>
</div>
);
}
}
import React,{Component}来自'React';
从“反应高光”导入高光;
导入“./node_modules/highlight.js/styles/tomory.css”;
导出默认类应用程序扩展组件{
render(){
返回(
例子
{“var test='hello'”}
);
}
}
您的开发环境是什么?吞咽网页包?您似乎没有一个正确的css文件处理程序?React不会神奇地处理css文件
在网页包中,您需要一个加载程序来处理css、sass和样式文件。
像
//css加载程序
{
测试:/\.css$/,,
加载器:“样式加载器!css加载器!postcss加载器”
},
//字体文件加载器
{
测试:/\.woff(2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
加载器:“url加载器?限制=10000&minetype=application/font-woff”
},
{
测试:/\(ttf | eot | svg)(\?v=[0-9]\[0-9]\[0-9])?$/,
加载器:“文件加载器”
}
您的开发环境是什么?吞咽网页包?您似乎没有一个正确的css文件处理程序?React不会神奇地处理css文件
在网页包中,您需要一个加载程序来处理css、sass和样式文件。
像
//css加载程序
{
测试:/\.css$/,,
加载器:“样式加载器!css加载器!postcss加载器”
},
//字体文件加载器
{
测试:/\.woff(2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
加载器:“url加载器?限制=10000&minetype=application/font-woff”
},
{
测试:/\(ttf | eot | svg)(\?v=[0-9]\[0-9]\[0-9])?$/,
加载器:“文件加载器”
}
你如何在你的应用程序中导入“明天”主题?你如何在你的应用程序中导入“明天”主题?我刚刚将该文件中的代码复制到main.css文件中,现在它突出显示了代码,不会出错将css文件添加到客户端目录应该可以工作!通过导入,给出css文件的相对路径!我刚刚将该文件中的代码复制到main.css文件中,现在它突出显示了代码,不会给我任何错误将css文件添加到客户机目录应该可以工作!通过导入,给出css文件的相对路径!