在 ember.js 插件中使用 sass

using sass in ember.js addon

我正在 ember.js 中为我的新 ember 应用程序开发插件。

我正在尝试弄清楚如何使用 sass 作为我的插件的样式并使其独立于我的应用程序。

说插件使用 sass 但使用它的应用程序没有必要在其 packages.json.[=16] 中包含 ember-cli-sass =]

我几乎尝试了 google 上的所有解决方案,我来这里寻求帮助:)

假设我的插件名称是 awesome-tables,因此如果我将 css 文件放入 awesome-tables/addon/styles/addon.css 中,样式会按预期连接到 vendor.css 中,但它不会为 sass / scss

工作

对于插件,您应该添加 @import 介绍您的 app.scss 如下(均来自插件)

@import 'ember-freestyle';
@import "pod-styles";

此类指令通常在 README.md 中描述用于 repo。如果这是你的回购 - 检查下一个代码 https://github.com/ebryn/ember-component-css/blob/ae18f897d5b40ef1b3346d8857f6a1136d1b7b4b/lib/include-all.js#L56 as example ( https://github.com/ebryn/ember-component-css/ 与 css/less/sass )

P.S。检查插件样式的命名 https://github.com/aexmachina/ember-cli-sass

Addon Development

If you want to use ember-cli-sass in an addon and you want to distribute the compiled CSS it must be installed as a dependency so that addon/styles/addon.scss is compiled into dist/assets/vendor.css.

P.P.S