# 从主题资产SCSS获取网址

**URL:** <https://meta.discourse.org/t/get-the-url-from-theme-asset-scss/263856>\
**Category:** Development\
**Created:** [2023年五月4日 16:47 UTC](https://meta.discourse.org/t/get-the-url-from-theme-asset-scss/263856 "2023-05-04T16:47:56Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)\
**Post date:** [2023年五月4日 16:56 UTC](https://meta.discourse.org/t/get-the-url-from-theme-asset-scss/263856/2 "2023-05-04T16:56:38Z")

</div>

这里有一些指导：[Include assets (e.g. images, fonts) in themes and components](https://meta.discourse.org/t/include-assets-e-g-images-fonts-in-themes-and-components/62459)

所以，在你的情况下，你会想这样做：

```scss
.logo {
     background-image: url($essential-logo);
}

```

你无法直接在 HTML 中访问资源，所以如果你不知道如何使用 JavaScript 或 Handlebars，你可能想将其用作 CSS 背景图像（这在上面我分享的链接中也有介绍）。

---

_[View the full topic](https://meta.discourse.org/t/get-the-url-from-theme-asset-scss/263856)._
