diff --git a/index.html b/index.html index b663e5646..1f418c245 100644 --- a/index.html +++ b/index.html @@ -650,12 +650,17 @@
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.
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) {
+ ...
+}
-@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; }
}
- 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; }
}