html-to-elm
html-to-elm copied to clipboard
Flowbite tailwind example output does not compile without post-processing
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