1.2.1 • Published 3 years ago

@marko-tags/match-media v1.2.1

Weekly downloads
395
License
MIT
Repository
github
Last release
3 years ago

Media queries directly in your Marko templates.

Note: version 1.0.0 of this module requires Marko >= 4.14.20 as it uses the new tag parameter syntax

Installation

npm install @marko-tags/match-media

Example

<match-media|{ mobile, tablet, desktop }|
  mobile="(max-width: 767px)"
  tablet="(min-width: 768px) and (max-width: 1024px)"
  desktop="(min-width: 1025px)"
>

  <if(mobile)>
    <!-- Mobile version -->
  <else-if(tablet)>
    <!-- Tablet version -->
  </else-if>
  <else-if(desktop)>
    <!-- Desktop version -->
  </else-if>
  <else>
    <!-- Handle server side render (no media queries match) -->
  </else>

</match-media>

Full media query support

<match-media|{ portrait, landscape }|
  portrait="(orientation: portrait)"
  landscape="(orientation: landscape)"
>

  <!-- Render based on portrait or landscape -->

</match-media>
1.2.1

3 years ago

1.2.0

3 years ago

1.1.1

4 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.0

6 years ago