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

前端 未结 11 853
执念已碎
执念已碎 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:35

    Use this in your server.js file

    app.use(express.static(__dirname + '/public'));
    

    and add css like

    
    

    dont need / before css like

    
    

提交回复
热议问题