Skip to content

Mustache.js can be clumsy for dealing with conditionalsΒ #3

@anthonyec

Description

@anthonyec
{{# collections.projects }}
  <div class="project {{^ isFirst }}project--hidden{{/ isFirst }} js-project">
    <img class="project__image js-project-thumbnail" src="{{ thumbnail }}" alt="">

    {{# image }}
      {{# isFirst }}
        <img class="project__image js-project-image" src="{{ image }}" alt="">
      {{/ isFirst }}
      {{^ isFirst }}
        <img class="project__image js-project-image" data-src="{{ image }}" alt="">
      {{/ isFirst }}
    {{/ image }}

    {{# video }}
      <video class="project__image js-project-video" src="{{ video }}" autoplay muted loop></video>
    {{/ video }}
  </div>
{{/ collections.projects }}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions