mbylstra / html-to-elm

An online tool for converting HTML to elm-html. Go to
http://mbylstra.github.io/html-to-elm/
395 stars 23 forks source link

Flowbite tailwind example output does not compile without post-processing #34

Open houseofmercy-github opened 2 years ago

houseofmercy-github commented 2 years ago

Trying out https://mbylstra.github.io/html-to-elm with flowbite examples generates Elm that requires imports and post-processing. Problem mainly lies in need for qualified Svg imports.

For reference here is a script that works with sed on osx that corrects the output for the samples on this page https://flowbite.com/docs/components/sidebar

#!/bin/bash

# Fixes output from https://mbylstra.github.io/html-to-elm
# Assumes imports:
#
#  import Html exposing (..)
#  import Html.Attributes exposing (..)
#  import Svg
#  import Svg.Attributes

sed -i .bak \
    -e 's/ d "/ Svg.Attributes.d "/g' \
    -e 's/ svg \[ class "/ Svg.svg [ Svg.Attributes.class "/g' \
    -e 's/ path / Svg.path /g' \
    -e 's/ viewBox "/ Svg.Attributes.viewBox "/g' \
    -e 's/ fill "/ Svg.Attributes.fill "/g' \
    Main.elm