Chat freely about anything...

User avatar
By Fyod
#41224 Hey guys,
I haven't yet gotten into using the ESP as a server that clients connect to to show info and will need that soon.
What I would like to know is how far the development has come in regards to styling the page that is served.
Is any basic css, images, maybe fonts possible at all *without an external connection*? Form over function in this case, need it to look good. I'm a webdev so I can make things nice even with basic code, but there's not much info anywhere about these capabilities.
I would prefer to do all programming of the ESP in Arduino if that makes any difference.

Thanks!
User avatar
By damage31
#41474 I've been playing with an Adafruit Huzzah for just over a month or so, and was in a similar situation as you- here are my observations so far: (I'm nowhere near an expert on any of this)

From what I know, you have a couple of options on how to serve up files to a web client from the esp webserver. You could use a string to serve up the most basic pieces of a webpage.

Then, when you exhaust that, another way (this is how I started) would be to use progmem to store the html/css/js, but this can have issues when things start to get large just like when using strings. Also, images pose a challenge.

The last way (and I would argue, probably the preferred way) is to use SPIFFS to store the html/css/js/images, and use FS.h to get them and stream them to the client. Note, I've still got to experiment here, but I think you can also serve up gzipped files which I would think would allow for some really large pages to get served...

I started out with string to do a "hello world", then moved to using progmem, but started running into random E:M reset stability issues (likely because I was running out of stack/heap), and have just yesterday I switched over to using SPIFFS, and things are much more stable now for me.