Page 1 of 1

Microdot cann't read local css files

Posted: Tue Nov 03, 2020 3:25 am
by draco.wang
Hi guys,
I am using microdot as the web server on ESP32, according example gpio.html: href="https://stackpath.bootstrapcdn.com/boot ... ap.min.css" , i downloaed the css file to local, and change the code to :
href="bootstrap.min.css" , after running got error message:
GET bootstrap.min.css 404

Re: Microdot cann't read local css files

Posted: Tue Nov 03, 2020 3:46 am
by jimmo
draco.wang wrote:
Tue Nov 03, 2020 3:25 am
GET bootstrap.min.css 404
The example doesn't have any code in it to respond to anything other than "/" (where it returns gpio.html for a GET, and handles the form for a POST). You'll need to add a handler for "/bootstrap.min.css" that uses send_file to return the CSS.

Re: Microdot cann't read local css files

Posted: Tue Nov 03, 2020 5:56 am
by draco.wang
Thank you very much , it worked :)

Re: Microdot cann't read local css files

Posted: Sun Aug 15, 2021 11:41 am
by dubaleeiro
hey @jimmo, the method you've described worked for me as well, thanks ! However I can't make the Font Awesome working...

I have saved the 'solid.min.css' file in one folder called 'src' (by the way, also where my working css style file is located) and created a handler for that. I addition, I've copied the 'webfonts' folder at the same level as the 'src', as explained here:
https://stackoverflow.com/questions/254 ... -using-cdn

However, the fonts are not being displayed... do I need a handler for each of the files in the 'webfonts' folder? I would appreciate any help on that!