Today I upgraded
my website from 0.14 and Graphics.Element to use elm-html. In the end I like the result but it took a little hair-pulling. It's not on GitHub but you can grab the
source.
Background, briefly: my website is meant to serve as a professional contact point and link to side projects. I want to not spend too much time on it, not master bootstrap/jquery/their ilk, but I want something that's half-decent on mobile. The most prominent thing there is an animated bar chart I made in D3, so I was a little worried about DOM diffing interfering with that. Turns out that if I created the SVG in Elm, it wouldn't render properly, but if I appended to a div made by Elm it works fine.
On the plus side, I'm using Markdown everywhere and that becomes easy to style with CSS, even if it means nesting h2->div->p elements. There's no way to add attributes or a different tag to elm-markdown; all you can do is make it the child of something. Additionally, there's no small caps option in the Text library, so before i had to assign it a tag (id) and use CSS of that; now i can do the sane thing and use a class, so I can add more than one. Most of the styling is in a separate CSS file.
The only place I use inline styles is with regard to spacing and layout. In the old version, I created spacer elements and flowed right to center the main content. After falling down a painful rabbit hole with CSS and positioning, including the problem of getting the spacers to extend down the end of the viewport when I didn't know how tall the page was, it occurred to me to use spacers at all. The body has a gray background, and the content div has a white one. Inline styles are used to set absolute positioning and width on the content div; these numbers are derived from Window.dimension. (It's a very hacky methodology for responsive design.) Now the problem was if the window was smaller than the div; the content flowed off when you scrolled. So I set overflow: scroll; which works except you can't scroll on the gray body. If someone has a better technique, I'd like to know what it is.
Another annoying thing was that virtual-dom will silently drop invalid attributes. I was passing widths without a specified unit and they just disappeared. Everything was fine when I started add "px" to the end. Furthermore, there was all sorts of crazy margins, which I had to strip out in CSS. I'm not sure what's going on there.
Jacob's Font Awesome library started this off, because how I was doing social media links before was visually similar but a total hack. It's great to have a native solution.
All-in-all, I learned some CSS and got much cleaner Elm code behind my website. Hopefully this writup was useful to someone.