Не работает css на двух одинаковых страницах
Столкнулся с проблемой, что на двух одинаковых страница не работает один и тот же css. На одной странице css отображатся нормально, а когда подключаю вторую страницу то css перестает работать и в консоле пишет Refused to apply style from because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled., хотя путь к css один и тот же. Вот код
var express = require('express');
var router = express.Router();
// get /
var Category = require('../models/category');
var Product = require('../models/products');
// it works good and css is working
router.get('/', function (req, res) {
Product.find(function (err, products) {
if (err) { console.log(err); }
res.render('all_product', { title: 'All products', products: products });
});
});
// get products by category
// it works bad and css is not working
router.get('/:category', function (req, res) {
var categorySlug = req.params.category;
Category.findOne({ slug: categorySlug }, function (err, c) {
Product.find({ category: categorySlug }, function (err, products) {
if (err) { console.log(err); }
res.render('cat_product', { title: c.title, products: products });
});
});
});
И вот старница
<%- include ('_layouts/header3'); -%>
//<link rel="stylesheet" href="../css/catalogstyle.css"> connect css( in header3.ejs). If I delete " ../", it won't work
<div id="colRight">
<div class="wrapper">
<% products.forEach(function(p){ %>
<div class="card">
<div class="face face1">
<div class="content">
<a href="/category/products/<%= p.category %>/<%=p.slug %>">
<img src="/product_images/<%= p.id %>/<%= p.image %>">
</a>
<h3><%= p.title %></h3>
<h4><%= parseFloat(p.price).toFixed(2) %> грн.</h4>
</div>
</div>
<div class="face face2">
<div class="content">
<p><%= p.desc %></p>
<a href="#">Read More</a>
</div>
</div>
</div>
<% }); %>
</div>
</div>
<div id="container">
<%- messages('messages',locals) %>
<%- include ('_layouts/footer3'); -%>