# 能否在插件中访问 Foundation 的 Sass 变量？

**URL:** <https://meta.discourse.org/t/can-i-access-foundation-sass-variables-in-a-plugin/89368>\
**Category:** Development\
**Created:** [2018年六月7日 15:10 UTC](https://meta.discourse.org/t/can-i-access-foundation-sass-variables-in-a-plugin/89368 "2018-06-07T15:10:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![coderberry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/coderberry/32/99652_2.png) [@coderberry](https://meta.discourse.org/u/coderberry)\
**Post date:** [2018年六月7日 15:10 UTC](https://meta.discourse.org/t/can-i-access-foundation-sass-variables-in-a-plugin/89368/1 "2018-06-07T15:10:27Z")

</div>

I would like to be able to access the foundation sass variables to support themes in the plugin I am working on. Is this possible?

For example, if I choose the ‘dark’ theme, I want my content to follow the same color scheme.

Right now, the only way I’m writing css is in the `register_css` method.

---

<div class="post-metadata">

**Author:** ![joebuhlig](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joebuhlig/32/193054_2.png) [@joebuhlig](https://meta.discourse.org/u/joebuhlig)\
**Post date:** [2018年六月7日 15:18 UTC](https://meta.discourse.org/t/can-i-access-foundation-sass-variables-in-a-plugin/89368/2 "2018-06-07T15:18:06Z")

</div>

You certainly can:

```plaintext
@import "common/foundation/variables";

```

Example use:

```plaintext
a {
    color: $primary;

    &:hover, &:focus {
      color: $secondary;
    }

    &:visited {
      color: $primary;
    }
  }

```

---

<div class="post-metadata">

**Author:** ![coderberry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/coderberry/32/99652_2.png) [@coderberry](https://meta.discourse.org/u/coderberry)\
**Post date:** [2018年六月7日 15:19 UTC](https://meta.discourse.org/t/can-i-access-foundation-sass-variables-in-a-plugin/89368/3 "2018-06-07T15:19:22Z")

</div>

> [@joebuhlig](#):
>
> @import “common/foundation/variables”;

So `register_css` accepts sass? That’s awesome!

---

<div class="post-metadata">

**Author:** ![joebuhlig](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joebuhlig/32/193054_2.png) [@joebuhlig](https://meta.discourse.org/u/joebuhlig)\
**Post date:** [2018年六月7日 15:43 UTC](https://meta.discourse.org/t/can-i-access-foundation-sass-variables-in-a-plugin/89368/4 "2018-06-07T15:43:45Z")

</div>

I usually put this at the top of my `.scss` file and run with it from there. If that’s what you mean.
