_theme-background-image.scss.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>The source code</title>
  6. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  7. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  8. <style type="text/css">
  9. .highlight { display: block; background-color: #ddd; }
  10. </style>
  11. <script type="text/javascript">
  12. function highlight() {
  13. document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
  14. }
  15. </script>
  16. </head>
  17. <body onload="prettyPrint(); highlight();">
  18. <pre class="prettyprint lang-js">/*
  19. * Method which inserts a full background-image property for a theme image.
  20. * It checks if the file exists and if it doesn't, it'll throw an error.
  21. * By default it will not include the background-image property if it is not found,
  22. * but this can be changed by changing the default value of $include-missing-images to
  23. * be true.
  24. */
  25. @function theme-background-image($theme-name, $path, $without-url: false, $relative: false) {
  26. $exists_image: theme-image($theme-name, $path, true, false);
  27. @if $exists_image {
  28. $exists: theme_image_exists($exists_image);
  29. @if $exists == true {
  30. @return theme-image($theme-name, $path, $without-url, $relative);
  31. }
  32. @else {
  33. @warn &quot;@theme-background-image: Theme image not found: #{$exists_image}&quot;;
  34. @if $include-missing-images {
  35. @return theme-image($theme-name, $path, $without-url, $relative);
  36. }
  37. @return none;
  38. }
  39. }
  40. @else {
  41. @warn &quot;@theme-background-image: No arguments passed&quot;;
  42. }
  43. }
  44. </pre>
  45. </body>
  46. </html>