简体   繁体   English

我的 Visual Studio Live 服务器扩展不能正常运行 function

[英]My visual studio live server extension doesn't function normally

So recently I started using the live server extension on Visual Studio.所以最近我开始在 Visual Studio 上使用实时服务器扩展。 The issue that I am having with it is that whenever I update my HTML or Javascript file, my CSS styling will no longer show on the browser, and I have to go to the CSS file and save it for them to show. The issue that I am having with it is that whenever I update my HTML or Javascript file, my CSS styling will no longer show on the browser, and I have to go to the CSS file and save it for them to show.

I have included some screenshots to try to explain my issue:我已经包含了一些屏幕截图来尝试解释我的问题: So as you can see when I am on the app.css file, the correct styling is shown on the broswer.因此,当我在 app.css 文件上时,您可以看到,正确的样式显示在浏览器上。 在此处输入图像描述 However when I go to my javascript or HTML file and add something then all the styling is removed.但是,当我将 go 到我的 javascript 或 HTML 文件并添加一些内容时,所有样式都会被删除。

I will appreciate it so much if someone could help me with my issue.如果有人可以帮助我解决我的问题,我将非常感激。

When I checked the chrome developer console for any error I found the following error:当我检查 chrome 开发者控制台是否有任何错误时,我发现以下错误:

Refused to apply style from ' http://127.0.0.1:5500/app.css/ ' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.拒绝应用来自“ http://127.0.0.1:5500/app.css/ ”的样式,因为它的 MIME 类型(“text/html”)不是受支持的样式表 MIME 类型,并且启用了严格的 MIME 检查。

Check to make sure that whenever you open vs code, you select open folder and select your current project, and that your html,css, and js files all open then. Check to make sure that whenever you open vs code, you select open folder and select your current project, and that your html,css, and js files all open then. When using live server(or at least on my machine), it will not work correctly unless the project is opened as a folder containing all of that projects files.使用实时服务器(或至少在我的机器上)时,除非项目作为包含所有项目文件的文件夹打开,否则它将无法正常工作。 I hope that makes sense and i hope that helps!我希望这是有道理的,我希望这会有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM