How can I include css files using node, express, and ejs?

前端 未结 11 848
执念已碎
执念已碎 2020-12-01 01:37

I\'m trying to follow the instructions to https://stackoverflow.com/a/18633827/2063561, but I still can\'t get my styles.css to load.

From app.js

ap         


        
11条回答
  •  半阙折子戏
    2020-12-01 02:28

    In your app or server.js file include this line:

    app.use(express.static('public'));

    In your index.ejs, following line will help you:

    I hope this helps, it did for me!

提交回复
热议问题