Tableau.DataExtension (tableau v0.26.0)

View Source

YAML files and Elixir scripts (.exs) in the configured directory will be automatically parsed/executed and made available in an @data assign in your templates.

Elixir scripts will be executed and the last expression returned as the data.

Configuration

  • :enabled - boolean - Extension is active or not.
  • :dir - string - Directory to scan for data files. Defaults to _data

Example

config :tableau, Tableau.DataExtension,
  enabled: true,
  dir: "_facts"

YAML

# _facts/homies.yaml
- name: Mitch
- name: Jimbo
- name: Bobby
<ul>
  <li :for={homie <- @data["homies"]}>
    <%= homie.name %>
  </li>
</ul>

Elixir

# _facts/homies.exs
resp = Req.get!("https://example.com/homies")

resp.body["homies"]
<ul>
  <li :for={homie <- @data["homies"]}>
    <%= homie.name %>
  </li>
</ul>