Using MongoDb in Phoenix framework

Sorry so keep bringing this up, but I’m still not sure I’m using this correctly.

I have an application with 20+ templates called blocks which can all potentially have different styles. They all share a “Block” schema but need a flexible way to add different styles which is why I thought jsonb would be the way to go.

[%Ap.Block{__meta__: #Ecto.Schema.Metadata<:loaded, "blocks">, 
  id: 1, 
  name: "foo",
  style: [%Ap.CustomField{
    data: [
      %{"color" => "red"},
      %{"h2" => "#303030"},
      %{"background-image" => "image.jpg"}
    ],
    id: "4222329c-cac4-4e1d-bfa6-6c440dcb7b59"}
  ], 
  template: "baz",
  inserted_at: #Ecto.DateTime<2016-11-18 00:58:41>,
  updated_at: #Ecto.DateTime<2016-11-18 00:58:41>}]

Basically, I want my final template to look something like the pseudo code below but I’m still not sure the best way to save the data and then how to easily access it later?

<style scoped>
  p {
    color: <%= style.data.color %>
  }
  h2 {
    color: <%= style.data.h2 %>
  }
</style>

<section style="background-image: <%= style.data.background-image %>">
  <h2>My Heading</h2>
  <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor.</p>
</section>