简体   繁体   English

资源解释为样式表,但使用 MIME 类型 text/x-scss 传输

[英]Resource interpreted as Stylesheet but transferred with MIME type text/x-scss

i want to create a website with nodejs but i have a problem with show style in scss and ejs .我想用 nodejs 创建一个网站,但我在scssejs中的显示样式有问题。

i have a scss style in folder ../app/public/scss and i using this middlware for set static file with express:我在文件夹../app/public/scss中有一个scss样式,我使用这个中间件来设置 static 文件,其中包含 express:

    app.use(express.static(path.join(__dirname,'public')));
    app.set('view engine', 'ejs');
    app.set('views' , path.join(__dirname,'../','resources/views'));

and in header i define the style by this way:在 header 我通过这种方式定义样式:

<link rel="stylesheet" type="text/css" href="/scss/vazir.scss">
<link rel="stylesheet" type="text/css" href="/scss/media-queries.scss">
<link rel="stylesheet" type="text/css" href="/scss/style.scss">

and i using the header by this way in the register.ejs:我通过这种方式在register.ejs:

<%- include('./../header.ejs'); %>

Registration登记

but when i go to the register page it show me this in console:但是当我 go 到注册页面时,它在控制台中显示了这个:

Resource interpreted as Stylesheet but transferred with MIME type text/x-scss: " http://localhost:3000/scss/vazir.scss ".资源解释为样式表,但使用 MIME 类型 text/x-scss 传输:“ http://localhost:3000/scss/vazir.scss ”。

register:9 Resource interpreted as Stylesheet but transferred with MIME type text/x-scss: " http://localhost:3000/scss/media-queries.scss ". register:9 资源解释为样式表,但使用 MIME 类型 text/x-scss 传输:“ http://localhost:3000/scss/media-queries.scss ”。

register:10 Resource interpreted as Stylesheet but transferred with MIME type text/x-scss: " http://localhost:3000/scss/style.scss ". register:10 资源解释为样式表,但使用 MIME 类型 text/x-scss 传输:“ http://localhost:3000/scss/style.scss ”。

whats the problem?有什么问题? how can i sovle this problem????我该如何解决这个问题????

Browsers don't support SCSS.浏览器不支持 SCSS。 You need to compile it to CSS and serve the CSS files to the browser.您需要将其编译为 CSS 并将 CSS 文件提供给浏览器。

There are various compilers that support it.有各种支持它的编译器。 SASS is the official one. SASS是官方的。 You might want to find one that integrates with your existing build toolchain.您可能希望找到一个与现有构建工具链集成的工具。

暂无
暂无

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

相关问题 Meteor Resource解释为样式表,但使用MIME类型text / html进行传输 - Meteor Resource interpreted as Stylesheet but transferred with MIME type text/html 资源被解释为样式表,但在 cloudflare 工作人员中使用 MIME 类型 text/html 传输 - Resource interpreted as Stylesheet but transferred with MIME type text/html in cloudflare workers 资源被解释为样式表,但使用 MIME 类型 text/javascript 传输 - Resource interpreted as Stylesheet but transferred with MIME type text/javascript Flask:资源被解释为样式表,但使用 MIME 类型 text/html 传输 - Flask: Resource interpreted as Stylesheet but transferred with MIME type text/html 资源被解释为样式表,但在 AngularJS 中使用 MIME 类型 text/html 传输 - Resource interpreted as Stylesheet but transferred with MIME type text/html in AngularJS Firebase“资源解释为样式表,但使用 MIME 类型 text/html 传输” - Firebase "Resource interpreted as Stylesheet but transferred with MIME type text/html" Chrome说“资源解释为样式表,但使用MIME类型text / html传输” - Chrome says “Resource interpreted as Stylesheet but transferred with MIME type text/html” 资源被解释为脚本,但以MIME类型text / x-js传输 - Resource interpreted as Script but transferred with MIME type text/x-js 资源被解释为样式表,但与mime一起传输 - Resource interpreted as Stylesheet but transferred with mime 链接的样式表错误-资源被解释为样式表,但以MIME类型文本/纯文本传输 - Linked Stylesheet Error - Resource interpreted as Stylesheet but transferred with MIME type text/plain
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM