html-to-elm icon indicating copy to clipboard operation
html-to-elm copied to clipboard

Flowbite tailwind example output does not compile without post-processing

Open houseofmercy-github opened this issue 3 years ago • 0 comments

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

houseofmercy-github avatar Apr 24 '22 05:04 houseofmercy-github