[241] | 1 | // skel.scss v3.0.0-dev | (c) n33 | skel.io | MIT licensed */
|
---|
| 2 |
|
---|
| 3 | // Vars.
|
---|
| 4 |
|
---|
| 5 | /// Breakpoints.
|
---|
| 6 | /// @var {list}
|
---|
| 7 | $breakpoints: () !global;
|
---|
| 8 |
|
---|
| 9 | /// Vendor prefixes.
|
---|
| 10 | /// @var {list}
|
---|
| 11 | $vendor-prefixes: (
|
---|
| 12 | '-moz-',
|
---|
| 13 | '-webkit-',
|
---|
| 14 | '-ms-',
|
---|
| 15 | ''
|
---|
| 16 | );
|
---|
| 17 |
|
---|
| 18 | /// Properties that should be vendorized.
|
---|
| 19 | /// @var {list}
|
---|
| 20 | $vendor-properties: (
|
---|
| 21 | 'align-content',
|
---|
| 22 | 'align-items',
|
---|
| 23 | 'align-self',
|
---|
| 24 | 'animation',
|
---|
| 25 | 'animation-delay',
|
---|
| 26 | 'animation-direction',
|
---|
| 27 | 'animation-duration',
|
---|
| 28 | 'animation-fill-mode',
|
---|
| 29 | 'animation-iteration-count',
|
---|
| 30 | 'animation-name',
|
---|
| 31 | 'animation-play-state',
|
---|
| 32 | 'animation-timing-function',
|
---|
| 33 | 'appearance',
|
---|
| 34 | 'backface-visibility',
|
---|
| 35 | 'box-sizing',
|
---|
| 36 | 'filter',
|
---|
| 37 | 'flex',
|
---|
| 38 | 'flex-basis',
|
---|
| 39 | 'flex-direction',
|
---|
| 40 | 'flex-flow',
|
---|
| 41 | 'flex-grow',
|
---|
| 42 | 'flex-shrink',
|
---|
| 43 | 'flex-wrap',
|
---|
| 44 | 'justify-content',
|
---|
| 45 | 'order',
|
---|
| 46 | 'perspective',
|
---|
| 47 | 'pointer-events',
|
---|
| 48 | 'transform',
|
---|
| 49 | 'transform-origin',
|
---|
| 50 | 'transform-style',
|
---|
| 51 | 'transition',
|
---|
| 52 | 'transition-delay',
|
---|
| 53 | 'transition-duration',
|
---|
| 54 | 'transition-property',
|
---|
| 55 | 'transition-timing-function'
|
---|
| 56 | );
|
---|
| 57 |
|
---|
| 58 | /// Values that should be vendorized.
|
---|
| 59 | /// @var {list}
|
---|
| 60 | $vendor-values: (
|
---|
| 61 | 'filter',
|
---|
| 62 | 'flex',
|
---|
| 63 | 'linear-gradient',
|
---|
| 64 | 'radial-gradient',
|
---|
| 65 | 'transform'
|
---|
| 66 | );
|
---|
| 67 |
|
---|
| 68 | // Functions.
|
---|
| 69 |
|
---|
| 70 | /// Removes a specific item from a list.
|
---|
| 71 | /// @author Hugo Giraudel
|
---|
| 72 | /// @param {list} $list List.
|
---|
| 73 | /// @param {integer} $index Index.
|
---|
| 74 | /// @return {list} Updated list.
|
---|
| 75 | @function remove-nth($list, $index) {
|
---|
| 76 |
|
---|
| 77 | $result: null;
|
---|
| 78 |
|
---|
| 79 | @if type-of($index) != number {
|
---|
| 80 | @warn "$index: #{quote($index)} is not a number for `remove-nth`.";
|
---|
| 81 | }
|
---|
| 82 | @else if $index == 0 {
|
---|
| 83 | @warn "List index 0 must be a non-zero integer for `remove-nth`.";
|
---|
| 84 | }
|
---|
| 85 | @else if abs($index) > length($list) {
|
---|
| 86 | @warn "List index is #{$index} but list is only #{length($list)} item long for `remove-nth`.";
|
---|
| 87 | }
|
---|
| 88 | @else {
|
---|
| 89 |
|
---|
| 90 | $result: ();
|
---|
| 91 | $index: if($index < 0, length($list) + $index + 1, $index);
|
---|
| 92 |
|
---|
| 93 | @for $i from 1 through length($list) {
|
---|
| 94 |
|
---|
| 95 | @if $i != $index {
|
---|
| 96 | $result: append($result, nth($list, $i));
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | @return $result;
|
---|
| 104 |
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | /// Replaces a substring within another string.
|
---|
| 108 | /// @author Hugo Giraudel
|
---|
| 109 | /// @param {string} $string String.
|
---|
| 110 | /// @param {string} $search Substring.
|
---|
| 111 | /// @param {string} $replace Replacement.
|
---|
| 112 | /// @return {string} Updated string.
|
---|
| 113 | @function str-replace($string, $search, $replace: '') {
|
---|
| 114 |
|
---|
| 115 | $index: str-index($string, $search);
|
---|
| 116 |
|
---|
| 117 | @if $index {
|
---|
| 118 | @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | @return $string;
|
---|
| 122 |
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | /// Replaces a substring within each string in a list.
|
---|
| 126 | /// @param {list} $strings List of strings.
|
---|
| 127 | /// @param {string} $search Substring.
|
---|
| 128 | /// @param {string} $replace Replacement.
|
---|
| 129 | /// @return {list} Updated list of strings.
|
---|
| 130 | @function str-replace-all($strings, $search, $replace: '') {
|
---|
| 131 |
|
---|
| 132 | @each $string in $strings {
|
---|
| 133 | $strings: set-nth($strings, index($strings, $string), str-replace($string, $search, $replace));
|
---|
| 134 | }
|
---|
| 135 |
|
---|
| 136 | @return $strings;
|
---|
| 137 |
|
---|
| 138 | }
|
---|
| 139 |
|
---|
| 140 | /// Gets a value from a map.
|
---|
| 141 | /// @author Hugo Giraudel
|
---|
| 142 | /// @param {map} $map Map.
|
---|
| 143 | /// @param {string} $keys Key(s).
|
---|
| 144 | /// @return {string} Value.
|
---|
| 145 | @function val($map, $keys...) {
|
---|
| 146 |
|
---|
| 147 | @if nth($keys, 1) == null {
|
---|
| 148 | $keys: remove-nth($keys, 1);
|
---|
| 149 | }
|
---|
| 150 |
|
---|
| 151 | @each $key in $keys {
|
---|
| 152 | $map: map-get($map, $key);
|
---|
| 153 | }
|
---|
| 154 |
|
---|
| 155 | @return $map;
|
---|
| 156 |
|
---|
| 157 | }
|
---|
| 158 |
|
---|
| 159 | // Mixins.
|
---|
| 160 |
|
---|
| 161 | /// Sets the global box model.
|
---|
| 162 | /// @param {string} $model Model (default is content).
|
---|
| 163 | @mixin boxModel($model: 'content') {
|
---|
| 164 |
|
---|
| 165 | $x: $model + '-box';
|
---|
| 166 |
|
---|
| 167 | *, *:before, *:after {
|
---|
| 168 | -moz-box-sizing: #{$x};
|
---|
| 169 | -webkit-box-sizing: #{$x};
|
---|
| 170 | box-sizing: #{$x};
|
---|
| 171 | }
|
---|
| 172 |
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 | /// Wraps @content in a @media block using a given breakpoint.
|
---|
| 176 | /// @param {string} $breakpoint Breakpoint.
|
---|
| 177 | /// @param {map} $queries Additional queries.
|
---|
| 178 | @mixin breakpoint($breakpoint: null, $queries: null) {
|
---|
| 179 |
|
---|
| 180 | $query: 'screen';
|
---|
| 181 |
|
---|
| 182 | // Breakpoint.
|
---|
| 183 | @if $breakpoint and map-has-key($breakpoints, $breakpoint) {
|
---|
| 184 | $query: $query + ' and ' + map-get($breakpoints, $breakpoint);
|
---|
| 185 | }
|
---|
| 186 |
|
---|
| 187 | // Queries.
|
---|
| 188 | @if $queries {
|
---|
| 189 | @each $k, $v in $queries {
|
---|
| 190 | $query: $query + ' and (' + $k + ':' + $v + ')';
|
---|
| 191 | }
|
---|
| 192 | }
|
---|
| 193 |
|
---|
| 194 | @media #{$query} {
|
---|
| 195 | @content;
|
---|
| 196 | }
|
---|
| 197 |
|
---|
| 198 | }
|
---|
| 199 |
|
---|
| 200 | /// Wraps @content in a @media block targeting a specific orientation.
|
---|
| 201 | /// @param {string} $orientation Orientation.
|
---|
| 202 | @mixin orientation($orientation) {
|
---|
| 203 | @media screen and (orientation: #{$orientation}) {
|
---|
| 204 | @content;
|
---|
| 205 | }
|
---|
| 206 | }
|
---|
| 207 |
|
---|
| 208 | /// Utility mixin for containers.
|
---|
| 209 | /// @param {mixed} $width Width.
|
---|
| 210 | @mixin containers($width) {
|
---|
| 211 |
|
---|
| 212 | // Locked?
|
---|
| 213 | $lock: false;
|
---|
| 214 |
|
---|
| 215 | @if length($width) == 2 {
|
---|
| 216 | $width: nth($width, 1);
|
---|
| 217 | $lock: true;
|
---|
| 218 | }
|
---|
| 219 |
|
---|
| 220 | // Modifiers.
|
---|
| 221 | .container.\31 25\25 { width: 100%; max-width: $width * 1.25; min-width: $width; }
|
---|
| 222 | .container.\37 5\25 { width: $width * 0.75; }
|
---|
| 223 | .container.\35 0\25 { width: $width * 0.5; }
|
---|
| 224 | .container.\32 5\25 { width: $width * 0.25; }
|
---|
| 225 |
|
---|
| 226 | // Main class.
|
---|
| 227 | .container {
|
---|
| 228 | @if $lock {
|
---|
| 229 | width: $width !important;
|
---|
| 230 | }
|
---|
| 231 | @else {
|
---|
| 232 | width: $width;
|
---|
| 233 | }
|
---|
| 234 | }
|
---|
| 235 |
|
---|
| 236 | }
|
---|
| 237 |
|
---|
| 238 | /// Utility mixin for grid.
|
---|
| 239 | /// @param {list} $gutters Column and row gutters (default is 40px).
|
---|
| 240 | /// @param {string} $breakpointName Optional breakpoint name.
|
---|
| 241 | @mixin grid($gutters: 40px, $breakpointName: null) {
|
---|
| 242 |
|
---|
| 243 | // Gutters.
|
---|
| 244 | @include grid-gutters($gutters);
|
---|
| 245 | @include grid-gutters($gutters, \32 00\25, 2);
|
---|
| 246 | @include grid-gutters($gutters, \31 50\25, 1.5);
|
---|
| 247 | @include grid-gutters($gutters, \35 0\25, 0.5);
|
---|
| 248 | @include grid-gutters($gutters, \32 5\25, 0.25);
|
---|
| 249 |
|
---|
| 250 | // Cells.
|
---|
| 251 | $x: '';
|
---|
| 252 |
|
---|
| 253 | @if $breakpointName {
|
---|
| 254 | $x: '\\28' + $breakpointName + '\\29';
|
---|
| 255 | }
|
---|
| 256 |
|
---|
| 257 | .\31 2u#{$x}, .\31 2u\24#{$x} { width: 100%; clear: none; margin-left: 0; }
|
---|
| 258 | .\31 1u#{$x}, .\31 1u\24#{$x} { width: 91.6666666667%; clear: none; margin-left: 0; }
|
---|
| 259 | .\31 0u#{$x}, .\31 0u\24#{$x} { width: 83.3333333333%; clear: none; margin-left: 0; }
|
---|
| 260 | .\39 u#{$x}, .\39 u\24#{$x} { width: 75%; clear: none; margin-left: 0; }
|
---|
| 261 | .\38 u#{$x}, .\38 u\24#{$x} { width: 66.6666666667%; clear: none; margin-left: 0; }
|
---|
| 262 | .\37 u#{$x}, .\37 u\24#{$x} { width: 58.3333333333%; clear: none; margin-left: 0; }
|
---|
| 263 | .\36 u#{$x}, .\36 u\24#{$x} { width: 50%; clear: none; margin-left: 0; }
|
---|
| 264 | .\35 u#{$x}, .\35 u\24#{$x} { width: 41.6666666667%; clear: none; margin-left: 0; }
|
---|
| 265 | .\34 u#{$x}, .\34 u\24#{$x} { width: 33.3333333333%; clear: none; margin-left: 0; }
|
---|
| 266 | .\33 u#{$x}, .\33 u\24#{$x} { width: 25%; clear: none; margin-left: 0; }
|
---|
| 267 | .\32 u#{$x}, .\32 u\24#{$x} { width: 16.6666666667%; clear: none; margin-left: 0; }
|
---|
| 268 | .\31 u#{$x}, .\31 u\24#{$x} { width: 8.3333333333%; clear: none; margin-left: 0; }
|
---|
| 269 |
|
---|
| 270 | .\31 2u\24#{$x} + *,
|
---|
| 271 | .\31 1u\24#{$x} + *,
|
---|
| 272 | .\31 0u\24#{$x} + *,
|
---|
| 273 | .\39 u\24#{$x} + *,
|
---|
| 274 | .\38 u\24#{$x} + *,
|
---|
| 275 | .\37 u\24#{$x} + *,
|
---|
| 276 | .\36 u\24#{$x} + *,
|
---|
| 277 | .\35 u\24#{$x} + *,
|
---|
| 278 | .\34 u\24#{$x} + *,
|
---|
| 279 | .\33 u\24#{$x} + *,
|
---|
| 280 | .\32 u\24#{$x} + *,
|
---|
| 281 | .\31 u\24#{$x} + * {
|
---|
| 282 | clear: left;
|
---|
| 283 | }
|
---|
| 284 |
|
---|
| 285 | .\-11u#{$x} { margin-left: 91.6666666667% }
|
---|
| 286 | .\-10u#{$x} { margin-left: 83.3333333333% }
|
---|
| 287 | .\-9u#{$x} { margin-left: 75% }
|
---|
| 288 | .\-8u#{$x} { margin-left: 66.6666666667% }
|
---|
| 289 | .\-7u#{$x} { margin-left: 58.3333333333% }
|
---|
| 290 | .\-6u#{$x} { margin-left: 50% }
|
---|
| 291 | .\-5u#{$x} { margin-left: 41.6666666667% }
|
---|
| 292 | .\-4u#{$x} { margin-left: 33.3333333333% }
|
---|
| 293 | .\-3u#{$x} { margin-left: 25% }
|
---|
| 294 | .\-2u#{$x} { margin-left: 16.6666666667% }
|
---|
| 295 | .\-1u#{$x} { margin-left: 8.3333333333% }
|
---|
| 296 |
|
---|
| 297 | }
|
---|
| 298 |
|
---|
| 299 | /// Utility mixin for grid.
|
---|
| 300 | /// @param {list} $gutters Gutters.
|
---|
| 301 | /// @param {string} $class Optional class name.
|
---|
| 302 | /// @param {integer} $multiplier Multiplier (default is 1).
|
---|
| 303 | @mixin grid-gutters($gutters, $class: null, $multiplier: 1) {
|
---|
| 304 |
|
---|
| 305 | // Expand gutters if it's not a list.
|
---|
| 306 | @if length($gutters) == 1 {
|
---|
| 307 | $gutters: ($gutters, 0);
|
---|
| 308 | }
|
---|
| 309 |
|
---|
| 310 | // Get column and row gutter values.
|
---|
| 311 | $c: nth($gutters, 1);
|
---|
| 312 | $r: nth($gutters, 2);
|
---|
| 313 |
|
---|
| 314 | // Get class (if provided).
|
---|
| 315 | $x: '';
|
---|
| 316 |
|
---|
| 317 | @if $class {
|
---|
| 318 | $x: '.' + $class;
|
---|
| 319 | }
|
---|
| 320 |
|
---|
| 321 | // Default.
|
---|
| 322 | .row#{$x} > * { padding: ($r * $multiplier) 0 0 ($c * $multiplier); }
|
---|
| 323 | .row#{$x} { margin: ($r * $multiplier * -1) 0 -1px ($c * $multiplier * -1); }
|
---|
| 324 |
|
---|
| 325 | // Uniform.
|
---|
| 326 | .row.uniform#{$x} > * { padding: ($c * $multiplier) 0 0 ($c * $multiplier); }
|
---|
| 327 | .row.uniform#{$x} { margin: ($c * $multiplier * -1) 0 -1px ($c * $multiplier * -1); }
|
---|
| 328 |
|
---|
| 329 | }
|
---|
| 330 |
|
---|
| 331 | /// Wraps @content in vendorized keyframe blocks.
|
---|
| 332 | /// @param {string} $name Name.
|
---|
| 333 | @mixin keyframes($name) {
|
---|
| 334 |
|
---|
| 335 | @-moz-keyframes #{$name} { @content; }
|
---|
| 336 | @-webkit-keyframes #{$name} { @content; }
|
---|
| 337 | @-ms-keyframes #{$name} { @content; }
|
---|
| 338 | @keyframes #{$name} { @content; }
|
---|
| 339 |
|
---|
| 340 | }
|
---|
| 341 |
|
---|
| 342 | ///
|
---|
| 343 | /// Sets breakpoints.
|
---|
| 344 | /// @param {map} $x Breakpoints.
|
---|
| 345 | ///
|
---|
| 346 | @mixin skel-breakpoints($x: ()) {
|
---|
| 347 | $breakpoints: $x !global;
|
---|
| 348 | }
|
---|
| 349 |
|
---|
| 350 | ///
|
---|
| 351 | /// Initializes layout module.
|
---|
| 352 | /// @param {map} config Config.
|
---|
| 353 | ///
|
---|
| 354 | @mixin skel-layout($config: ()) {
|
---|
| 355 |
|
---|
| 356 | // Config.
|
---|
| 357 | $configPerBreakpoint: ();
|
---|
| 358 |
|
---|
| 359 | $z: map-get($config, 'breakpoints');
|
---|
| 360 |
|
---|
| 361 | @if $z {
|
---|
| 362 | $configPerBreakpoint: $z;
|
---|
| 363 | }
|
---|
| 364 |
|
---|
| 365 | // Reset.
|
---|
| 366 | $x: map-get($config, 'reset');
|
---|
| 367 |
|
---|
| 368 | @if $x {
|
---|
| 369 |
|
---|
| 370 | /* Reset */
|
---|
| 371 |
|
---|
| 372 | @include reset($x);
|
---|
| 373 |
|
---|
| 374 | }
|
---|
| 375 |
|
---|
| 376 | // Box model.
|
---|
| 377 | $x: map-get($config, 'boxModel');
|
---|
| 378 |
|
---|
| 379 | @if $x {
|
---|
| 380 |
|
---|
| 381 | /* Box Model */
|
---|
| 382 |
|
---|
| 383 | @include boxModel($x);
|
---|
| 384 |
|
---|
| 385 | }
|
---|
| 386 |
|
---|
| 387 | // Containers.
|
---|
| 388 | $containers: map-get($config, 'containers');
|
---|
| 389 |
|
---|
| 390 | @if $containers {
|
---|
| 391 |
|
---|
| 392 | /* Containers */
|
---|
| 393 |
|
---|
| 394 | .container {
|
---|
| 395 | margin-left: auto;
|
---|
| 396 | margin-right: auto;
|
---|
| 397 | }
|
---|
| 398 |
|
---|
| 399 | // Use default is $containers is just "true".
|
---|
| 400 | @if $containers == true {
|
---|
| 401 | $containers: 960px;
|
---|
| 402 | }
|
---|
| 403 |
|
---|
| 404 | // Apply base.
|
---|
| 405 | @include containers($containers);
|
---|
| 406 |
|
---|
| 407 | // Apply per-breakpoint.
|
---|
| 408 | @each $name in map-keys($breakpoints) {
|
---|
| 409 |
|
---|
| 410 | // Get/use breakpoint setting if it exists.
|
---|
| 411 | $x: map-get($configPerBreakpoint, $name);
|
---|
| 412 |
|
---|
| 413 | // Per-breakpoint config exists?
|
---|
| 414 | @if $x {
|
---|
| 415 | $y: map-get($x, 'containers');
|
---|
| 416 |
|
---|
| 417 | // Setting exists? Use it.
|
---|
| 418 | @if $y {
|
---|
| 419 | $containers: $y;
|
---|
| 420 | }
|
---|
| 421 |
|
---|
| 422 | }
|
---|
| 423 |
|
---|
| 424 | // Create @media block.
|
---|
| 425 | @media screen and #{map-get($breakpoints, $name)} {
|
---|
| 426 | @include containers($containers);
|
---|
| 427 | }
|
---|
| 428 |
|
---|
| 429 | }
|
---|
| 430 |
|
---|
| 431 | }
|
---|
| 432 |
|
---|
| 433 | // Grid.
|
---|
| 434 | $grid: map-get($config, 'grid');
|
---|
| 435 |
|
---|
| 436 | @if $grid {
|
---|
| 437 |
|
---|
| 438 | /* Grid */
|
---|
| 439 |
|
---|
| 440 | // Use defaults if $grid is just "true".
|
---|
| 441 | @if $grid == true {
|
---|
| 442 | $grid: ();
|
---|
| 443 | }
|
---|
| 444 |
|
---|
| 445 | // Sub-setting: Gutters.
|
---|
| 446 | $grid-gutters: 40px;
|
---|
| 447 | $x: map-get($grid, 'gutters');
|
---|
| 448 |
|
---|
| 449 | @if $x {
|
---|
| 450 | $grid-gutters: $x;
|
---|
| 451 | }
|
---|
| 452 |
|
---|
| 453 | // Rows.
|
---|
| 454 | .row {
|
---|
| 455 | border-bottom: solid 1px transparent;
|
---|
| 456 | -moz-box-sizing: border-box;
|
---|
| 457 | -webkit-box-sizing: border-box;
|
---|
| 458 | box-sizing: border-box;
|
---|
| 459 | }
|
---|
| 460 |
|
---|
| 461 | .row > * {
|
---|
| 462 | float: left;
|
---|
| 463 | -moz-box-sizing: border-box;
|
---|
| 464 | -webkit-box-sizing: border-box;
|
---|
| 465 | box-sizing: border-box;
|
---|
| 466 | }
|
---|
| 467 |
|
---|
| 468 | .row:after, .row:before {
|
---|
| 469 | content: '';
|
---|
| 470 | display: block;
|
---|
| 471 | clear: both;
|
---|
| 472 | height: 0;
|
---|
| 473 | }
|
---|
| 474 |
|
---|
| 475 | .row.uniform > * > :first-child {
|
---|
| 476 | margin-top: 0;
|
---|
| 477 | }
|
---|
| 478 |
|
---|
| 479 | .row.uniform > * > :last-child {
|
---|
| 480 | margin-bottom: 0;
|
---|
| 481 | }
|
---|
| 482 |
|
---|
| 483 | // Gutters (0%).
|
---|
| 484 | @include grid-gutters($grid-gutters, \30 \25, 0);
|
---|
| 485 |
|
---|
| 486 | // Apply base.
|
---|
| 487 | @include grid($grid-gutters);
|
---|
| 488 |
|
---|
| 489 | // Apply per-breakpoint.
|
---|
| 490 | @each $name in map-keys($breakpoints) {
|
---|
| 491 |
|
---|
| 492 | // Get/use breakpoint setting if it exists.
|
---|
| 493 | $x: map-get($configPerBreakpoint, $name);
|
---|
| 494 |
|
---|
| 495 | // Per-breakpoint config exists?
|
---|
| 496 | @if $x {
|
---|
| 497 | $y: map-get($x, 'grid');
|
---|
| 498 |
|
---|
| 499 | // Setting exists?
|
---|
| 500 | @if $y {
|
---|
| 501 |
|
---|
| 502 | // Sub-setting: Gutters.
|
---|
| 503 | $x: map-get($y, 'gutters');
|
---|
| 504 |
|
---|
| 505 | @if $x {
|
---|
| 506 | $grid-gutters: $x;
|
---|
| 507 | }
|
---|
| 508 |
|
---|
| 509 | }
|
---|
| 510 |
|
---|
| 511 | }
|
---|
| 512 |
|
---|
| 513 | // Create @media block.
|
---|
| 514 | @media screen and #{map-get($breakpoints, $name)} {
|
---|
| 515 | @include grid($grid-gutters, $name);
|
---|
| 516 | }
|
---|
| 517 |
|
---|
| 518 | }
|
---|
| 519 |
|
---|
| 520 | }
|
---|
| 521 |
|
---|
| 522 | }
|
---|
| 523 |
|
---|
| 524 | /// Resets browser styles.
|
---|
| 525 | /// @param {string} $mode Mode (default is 'normalize').
|
---|
| 526 | @mixin reset($mode: 'normalize') {
|
---|
| 527 |
|
---|
| 528 | @if $mode == 'normalize' {
|
---|
| 529 |
|
---|
| 530 | // normalize.css v3.0.2 | MIT License | git.io/normalize
|
---|
| 531 | html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}
|
---|
| 532 |
|
---|
| 533 | }
|
---|
| 534 | @else if $mode == 'full' {
|
---|
| 535 |
|
---|
| 536 | // meyerweb.com/eric/tools/css/reset v2.0 | 20110126 | License: none (public domain)
|
---|
| 537 | html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline;}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block;}body{line-height:1;}ol,ul{list-style:none;}blockquote,q{quotes:none;}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;}table{border-collapse:collapse;border-spacing:0;}body{-webkit-text-size-adjust:none}
|
---|
| 538 |
|
---|
| 539 | }
|
---|
| 540 |
|
---|
| 541 | }
|
---|
| 542 |
|
---|
| 543 | /// Vendorizes a declaration's property and/or value(s).
|
---|
| 544 | /// @param {string} $property Property.
|
---|
| 545 | /// @param {mixed} $value String/list of value(s).
|
---|
| 546 | @mixin vendor($property, $value) {
|
---|
| 547 |
|
---|
| 548 | // Determine if property should expand.
|
---|
| 549 | $expandProperty: index($vendor-properties, $property);
|
---|
| 550 |
|
---|
| 551 | // Determine if value should expand (and if so, add '-prefix-' placeholder).
|
---|
| 552 | $expandValue: false;
|
---|
| 553 |
|
---|
| 554 | @each $x in $value {
|
---|
| 555 | @each $y in $vendor-values {
|
---|
| 556 | @if $y == str-slice($x, 1, str-length($y)) {
|
---|
| 557 |
|
---|
| 558 | $value: set-nth($value, index($value, $x), '-prefix-' + $x);
|
---|
| 559 | $expandValue: true;
|
---|
| 560 |
|
---|
| 561 | }
|
---|
| 562 | }
|
---|
| 563 | }
|
---|
| 564 |
|
---|
| 565 | // Expand property?
|
---|
| 566 | @if $expandProperty {
|
---|
| 567 | @each $vendor in $vendor-prefixes {
|
---|
| 568 | #{$vendor}#{$property}: #{str-replace-all($value, '-prefix-', $vendor)};
|
---|
| 569 | }
|
---|
| 570 | }
|
---|
| 571 |
|
---|
| 572 | // Expand just the value?
|
---|
| 573 | @elseif $expandValue {
|
---|
| 574 | @each $vendor in $vendor-prefixes {
|
---|
| 575 | #{$property}: #{str-replace-all($value, '-prefix-', $vendor)};
|
---|
| 576 | }
|
---|
| 577 | }
|
---|
| 578 |
|
---|
| 579 | // Neither? Treat them as a normal declaration.
|
---|
| 580 | @else {
|
---|
| 581 | #{$property}: #{$value};
|
---|
| 582 | }
|
---|
| 583 |
|
---|
| 584 | } |
---|