_image.scss 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. $image-map: () !default;
  2. @function inline-image-store($attr, $value: null) {
  3. $selector: &;
  4. $map: ();
  5. $list: ();
  6. @if map-has-key($image-map, $attr) {
  7. $map: map-get($image-map, $attr);
  8. @if map-has-key($map, $value) {
  9. $list: map-get($map, $value);
  10. }
  11. }
  12. $list: append($list, $selector, comma);
  13. $map: map-merge($map, ($value: $list));
  14. $image-map: map-merge($image-map, ($attr: $map)) !global;
  15. @return null;
  16. }
  17. @mixin inline-images-flash() {
  18. $selectors: ();
  19. @each $attr, $map in $image-map {
  20. @each $value, $selector in $map {
  21. $attributes: ();
  22. @if map-has-key($selectors, $selector) {
  23. $attributes: map-get($selectors, $selector);
  24. }
  25. $attributes: map-merge($attributes, ($attr: $value));
  26. $selectors: map-merge($selectors, ($selector: $attributes));
  27. }
  28. }
  29. @each $selector, $attributes in $selectors {
  30. #{$selector} {
  31. @each $attr, $value in $attributes {
  32. @if $attr == content {
  33. content: inline_image($value) !important;
  34. } @else if $attr == background {
  35. background-image: inline_image($value) !important;
  36. } @else {
  37. #{$attr}: $value;
  38. }
  39. }
  40. }
  41. }
  42. $image-map: () !global;
  43. }