Packages

WebAssembly is a web DSL for Elixir. You create html structure straight using do blocks. Means, you can intermix html-building blocks with full Elixir syntax. DSL output is an iolist, which you can flatten to string, but better use is to just feed it to the socket (via Plug & Cowboy). WebAssem...

Current section

Files

Jump to
webassembly lib webassembly.ex
Raw

lib/webassembly.ex

defmodule WebAssembly do
@moduledoc """
Wrapper module for assembling html document using macros.
Main entry point is `WebAssembly.DSL.builder/1`, which prepares
environment for using HTML macros from `WebAssembly.HTML` module.
These modules are automatically imported, so you just use:
use WebAssembly
builder do
div "mydiv" do
#...
end
end
"""
defmacro __using__(_opts) do
quote do
import WebAssembly.DSL
use WebAssembly.HTML
end
end
end