[英]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 创建一个网站,但我在scss
和ejs
中的显示样式有问题。
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'); %>
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.