Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avh4/elm-compile-html
Compile HTML templates into Elm code
https://github.com/avh4/elm-compile-html
Last synced: about 2 months ago
JSON representation
Compile HTML templates into Elm code
- Host: GitHub
- URL: https://github.com/avh4/elm-compile-html
- Owner: avh4
- Created: 2015-07-12T01:16:32.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-07-14T06:32:30.000Z (over 9 years ago)
- Last Synced: 2024-04-13T16:20:14.965Z (8 months ago)
- Language: Elm
- Homepage: https://elm-compile-html.herokuapp.com
- Size: 258 KB
- Stars: 7
- Watchers: 4
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Compile HTML files into Elm code!
### Installation
```bash
git clone https://github.com/avh4/elm-compile-html.git
cd elm-compile-html
npm install --global
```### Use
```bash
elm-package install evancz/elm-html
elm-compile-html MyHtmlFile.html > MyHtmlFile.elm
```You can now import `MyHtmlFile` as an Elm module:
```elm
import MyHtmlFilemain = MyHtmlFile.render
```## Example
MyPanel.html:
```html
Panel title
Panel content
```Running `elm-compile MyPanel.html` yields:
```elm
module MyPanel whereimport Html exposing (Html)
import Html.Attributes as Attrrender : Html
render = Html.node "div"
[ Attr.attribute "class" "panel panel-default" ]
[ Html.text "\n "
, Html.node "div"
[ Attr.attribute "class" "panel-heading" ]
[ Html.text "\n "
, Html.node "h3" [ Attr.attribute "class" "panel-title" ] [ Html.text "Panel title" ]
, Html.text "\n "
]
, Html.text "\n "
, Html.node "div" [ Attr.attribute "class" "panel-body" ] [ Html.text "\n Panel content\n " ]
, Html.text "\n"
]
```## Demos
See `examples/Clock/README.md`.
## Development
Running tests:
```bash
npm test
```