Code: Select all
ejs_portfolio/
├── public/
│ ├── stylesheets/
│ │ └── style.css
│ ├── images/
│ │ └── kawsNWF.png
│ │ └── Potter.png
│ │ └── image1.1.png
│ └── videos/
│ └── Video.mp4
├── views/
│ ├── layout.ejs
│ ├── header.ejs
│ ├── footer.ejs
│ ├── home.ejs
│ ├── aboutMe.ejs
│ ├── contactMe.ejs
│ └── myProjects.ejs
├── routes/
└── app.js
Code: Select all
const express = require('express')
const path = require('path');
const app = express();
// Serve static files
app.use(express.static(path.join(__dirname, 'public')));
// View engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
// Routes
const indexRouter = require('./routes/index');
app.use('/', indexRouter);
Code: Select all
[*]
Direkter Zugriff : Ich kann auf http: // localhost: 3000/stylesheets/style zugreifen. />
[*] Inline -Stil -Test : Wenn ich direkt in Layout.ejs ein Inline -Tag hinzufüge, gelten die Stile nicht. Nur HTML -Inline -Stil funktioniert. < /P>
Code: Select all
Hello;
Fragen: < /h3>
Gibt es noch andere Gründe, warum style.css < /code> in meinem EJS -Layout nicht angewendet wird, obwohl es korrekt serviert wurde? fehlen?>