This repository has been archived on 2023-08-07. You can view files and clone it, but cannot push or open issues or pull requests.
temple/guides/converting-html.md
2022-09-11 22:39:31 -04:00

818 B

Converting HTML

If you want to use something like TailwindUI with Temple, you're going to have to convert a ton of vanilla HTML into Temple syntax.

Luckily, Temple provides a mix task for converting an HTML file into Temple syntax and writes it to stdout.

Usage

First, we would want to create a temporary HTML file with the HTML we'd like to convert.

Hint {: .tip}

The following examples use the pbpaste and pbcopy utilities found on macOS. These are used to send your clipboard contents into stdout and put stdout into your clipboard.

$ pbpaste > temp.html

Then, we can convert that file and copy the output into our clipboard.

$ mix temple.convert temp.html | pbcopy

Now, you are free to paste the new temple syntax into your project!