Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. // ----
  2. // Sass (v3.4.21)
  3. // Compass (v1.0.3)
  4. // ----
  5.  
  6. // global breakpoints
  7. $tiny: 320px !default;
  8. $small: 480px !default;
  9. $medium: 600px !default;
  10. $large: 768px !default;
  11. $xlarge: 1024px,'no-query' true !default; // fallback for IE8
  12. $xxlarge: 1280px !default;
  13. $huge: 1600px !default;
  14.  
  15. // config/_breakpoints.scss
  16. $breakpoints: (
  17. 'tiny': 320px,
  18. 'small': 480px,
  19. 'medium': 600px,
  20. 'large': 768px,
  21. 'xlarge': 1024px,
  22. 'xxlarge': 1280px,
  23. 'huge': 1600px
  24. );
  25.  
  26. // config/_typography.scss
  27. $text-sizing: (
  28. 'centi': (
  29. 'small': (
  30. 'font-size': 12px,
  31. 'line-height': 16px
  32. )
  33. ),
  34. 'deci': (
  35. 'small': (
  36. 'font-size': 14px,
  37. 'line-height': 20px
  38. )
  39. ),
  40. 'base': (
  41. 'small': (
  42. 'font-size': 16px,
  43. 'line-height': 26px
  44. )
  45. ),
  46. 'deca': (
  47. 'small': (
  48. 'font-size': 18px,
  49. 'line-height': 26px
  50. ),
  51. 'large': (
  52. 'font-size': 20px,
  53. 'line-height': 30px
  54. )
  55. ),
  56. 'h3': (
  57. 'small': (
  58. 'font-size': 22px,
  59. 'line-height': 28px
  60. ),
  61. 'large': (
  62. 'font-size': 24px,
  63. 'line-height': 32px
  64. )
  65. ),
  66. 'h2': (
  67. 'small': (
  68. 'font-size': 24px,
  69. 'line-height': 32px
  70. ),
  71. 'large': (
  72. 'font-size': 28px,
  73. 'line-height': 36px
  74. )
  75. ),
  76. 'h1': (
  77. 'small': (
  78. 'font-size': 24px,
  79. 'line-height': 32px
  80. ),
  81. 'xlarge': (
  82. 'font-size': 58px,
  83. 'line-height': 85px
  84. )
  85. )
  86. );
  87.  
  88.  
  89. // lib/functions/_responsive.scss
  90. @function breakpoint($breakpoint-name) {
  91. $breakpoint-value: map-get($breakpoints, $breakpoint-name);
  92.  
  93. @if $breakpoint-value {
  94. @return $breakpoint-value;
  95. }
  96.  
  97. @warn "Breakpoint '#{$breakpoint-name}' not found in $breakpoints";
  98. }
  99.  
  100. // lib/functions/_typography.scss
  101. @function text-breakpoints-for($text-size) {
  102. $text-breakpoints: map-get($text-sizing, $text-size);
  103.  
  104. @if $text-breakpoints {
  105. @return $text-breakpoints;
  106. }
  107.  
  108. @warn "Text size '#{$text-size}' not found in $text-sizing";
  109. }
  110.  
  111. @function text-properties-for($text-size, $breakpoint-name) {
  112. $text-breakpoints: text-breakpoints-for($text-size);
  113. $text-properties: map-get($text-breakpoints, $breakpoint-name);
  114.  
  115. @if $text-properties {
  116. @return $text-properties;
  117. }
  118.  
  119. @warn "Breakpoint '#{$breakpoint-name}' for text size '#{$text-size}' was not found";
  120. }
  121.  
  122. // lib/mixins/_responsive.scss
  123. @mixin respond-above($breakpoint-name) {
  124. $breakpoint-value: breakpoint($breakpoint-name);
  125.  
  126. @if $breakpoint-value {
  127. @media screen and (min-width: $breakpoint-value) {
  128. @content;
  129. }
  130. }
  131. }
  132.  
  133. // lib/mixins/_typography.scss
  134. @mixin text-size($text-size, $breakpoint-name: 'small') {
  135. $text-size-properties: text-properties-for($text-size, $breakpoint-name);
  136.  
  137. @if $text-size-properties {
  138. font-size: map-get($text-size-properties, 'font-size');
  139. line-height: map-get($text-size-properties, 'line-height');
  140. }
  141. }
  142.  
  143. @mixin responsive-text-size($text-size, $default-breakpoint: 'small') {
  144. @include text-size($text-size, $default-breakpoint);
  145.  
  146. $text-breakpoints-map: text-breakpoints-for($text-size);
  147. $text-breakpoints-keys: map-keys($text-breakpoints-map);
  148.  
  149. @each $breakpoint-name in $text-breakpoints-keys {
  150. @if $breakpoint-name != $default-breakpoint {
  151. @include respond-above($breakpoint-name) {
  152. @include text-size($text-size, $breakpoint-name);
  153. }
  154. }
  155. }
  156. }
  157.  
  158. // _typography.scss
  159. h1,
  160. .text--mega {
  161. @include responsive-text-size('mega');
  162. }
  163.  
  164. h2,
  165. .text--kilo {
  166. @include responsive-text-size('kilo');
  167. }
  168.  
  169. h3,
  170. .text--hecto {
  171. @include responsive-text-size('hecto');
  172. }
  173.  
  174. h4,
  175. .text--deca {
  176. @include responsive-text-size('deca');
  177. }
  178.  
  179. h5,
  180. h6,
  181. body,
  182. .text--base {
  183. @include responsive-text-size('base');
  184. }
  185.  
  186. .text--deci {
  187. @include responsive-text-size('deci');
  188. }
  189.  
  190. small,
  191. .text--centi {
  192. @include responsive-text-size('centi');
  193. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement