The code listing are "Program Listing" sections in Lyx (http://www.lyx.org). Unfortunately Elyxer (http://www.nongnu.org/elyxer/), the Lyx->HTML converter, doesn't yet understand these sections and so skips them. I'm going to patch it to allow for these, and I'll also provide a PDF build next to the HTML export.
In my first (now trashed) version of the book I had started writing an introduction, but it got long-winded and verbose because I didn't know what I was introducing! Better to add the introduction in at the end, as you've mentioned :)