theme-background-image.scss 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Method which inserts a full background-image property for a theme image.
  3. * It checks if the file exists and if it doesn't, it'll throw an error.
  4. * By default it will not include the background-image property if it is not found,
  5. * but this can be changed by changing the default value of $include-missing-images to
  6. * be true.
  7. */
  8. @function theme-background-image($path, $extension: $image-extension, $nocheck: false) {
  9. $path: file_join($relative-image-path-for-uis, $path + '.' + $extension);
  10. $background-image: none;
  11. @if $path {
  12. @if $nocheck {
  13. $background-image: $path;
  14. } @else if theme_image_exists($image-search-path, $path) {
  15. $background-image: $path;
  16. } @else {
  17. @if $enable-missing-image-warnings {
  18. @warn "@theme-background-image: Theme image not found: #{$path}";
  19. }
  20. @if $include-missing-images {
  21. $background-image: $path;
  22. }
  23. }
  24. @if $background-image != none {
  25. $background-image: url(file_join($theme-resource-path, $path));
  26. }
  27. } @else {
  28. @warn "@theme-background-image: No arguments passed";
  29. }
  30. @return $background-image;
  31. }