From 7c0cfde974917fe9c61da150ff55ceb7ba255814 Mon Sep 17 00:00:00 2001 From: Carson Shold Date: Wed, 18 Mar 2015 09:57:27 -0400 Subject: [PATCH] Update to at-query mixin docs --- index.html | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index b663e5646..1f418c245 100644 --- a/index.html +++ b/index.html @@ -650,12 +650,17 @@

2.5 Sass Mixi

Shopify liquid files don't support @import. This means you can't rely on helpers like Compass or Bourbon. Instead, there is a section called Sass Mixins in timber.scss.liquid that provides a few of these helpers that you may be looking for.

Breakpoint Mixin

-

Mixin source: http://blog.grayghostvisuals.com/sass/sass-media-query-mixin/

+

Mixin based on: http://blog.grayghostvisuals.com/sass/sass-media-query-mixin/

Note: Standard media queries will obviously work as well if you'd rather not use the at-query mixin.

-

Use this simple mixin to create media queries. Breakpoints are defined under Breakpoint and Grid Variables in timber.scss.liquid. This mixin can wrap class declarations (Example 1 in Code tab), or be placed within them (Example 2 in Code tab).

+

Use this simple mixin to create media queries. Breakpoints are defined under Breakpoint and Grid Variables in timber.scss.liquid. This mixin can wrap class declarations (Example 1 below), or be placed within them (Example 2 below).

+

Make use of $min or $max variables for the constraint and the breakpoint variables defined under #Breakpoint and Grid Variables for the viewports.

-@mixin at-query($constraint, $viewport1, $viewport2: null) { ... }
+$min: min-width;
+$max: max-width;
+@mixin at-query($constraint_, $viewport1_, $viewport2_:null) {
+  ...
+}
 
@@ -708,29 +713,36 @@

Breakpoint Mixin

-

Example 1

+

Example 1 | Max-width query

-@include at-query('max-width', $small) {
+@include at-query($max, $small) {
   .foo {
     font-size: 0.8em;
   }
 }
 
 Output:
-@media screen and (max-width: 768px) {
+@media screen and (max-width: 480px) {
   .foo { font-size: 0.8em; }
 }
 
-

Example 2

+

Example 2 | Min and max-width query

+

The first parameter is optional when creating in-between queries. The two following snippets generate the same output.

 .foo {
-  @include at-query(null, 480px, 768px) {
+  @include at-query(null, $postSmall, $medium) {
+    font-size: 0.8em;
+  }
+}
+
+.foo {
+  @include at-query($postSmall, $medium) {
     font-size: 0.8em;
   }
 }
 
 Output:
-@media screen and (min-width: 480px) and (max-width: 768px) {
+@media screen and (min-width: 481px) and (max-width: 768px) {
   .foo { font-size: 0.8em; }
 }