-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addon modules imported after addon variables #155
Comments
To make sure I'm understanding right, your goal is to have ECM emit a single I think, because of how the overall build pipeline works, that this may not be possible. The reason ember-cli-sass has you put your files in However, anything you put in your addon's How complex are the variables you're wanting to have the host app set? Are they typically derived from other Sass variables it already has set up, or is it more one-time configuration? The ECM-native solution to this kind of thing is virtual modules, but that moves the configuration out of your stylesheet entirely and into build options, which may or may not suit your needs. |
Sorry I wasn't super clear, my layout looks something like:
where components.scss imports component styles (pre css-modules) and the So now with css-modules I want to have the new modules file imported inside of components.scss after the import of variables.scss. Hope that clarifies a bit 🤦♂ |
I see, so it's not the host app that's defining the variables? In that case I think your problem is still roughly what I described, but it's solvable because you can move things into the Usually for this kind of thing we recommend using an extension to distinguish between files you want treated as module and the ones you want to be plain Sass. Then you could configure ECM in your module.exports = {
// ...
options: {
cssModules: {
extension: 'm.scss',
intermediateOutputPath: '_modules.scss',
postcssOptions: {
syntax: require('postcss-scss'),
},
},
},
}; Then your layout would look something like this:
Then in your @import 'variables';
@import 'modules';
// any other imports of non-module Sass With this setup, the host app would no longer be importing any Sass, and your addon's styles would wind up in |
Hum, I think everything sounds good except for:
Mainly because |
Although variables get compiled out I think, so maybe it's worth having it imported in the host app as well. |
I think this comment #97 (comment) describes my exact predicament. If I could do |
You might be able to do |
So I have a addon (@org prfixed) that has variables and components. Currently I expose the addon's styles by putting them in the
app/styles/somename
folder. I'm not in love with this, so would be alright to change. This stylehttps://github.com/aexmachina/ember-cli-sass/blob/master/README.md#alternative-addon-usage
I've tried a few variations of
in my
index.js
and can't figure out where the module is placed. I tried to import the modules in my app via@import '@org/addon/modules'
but no luck. I also tried the same in the addon's app folder as well as just importing modules@import 'modules'
.What I ultimately want is to import the addon styles either explicitly or not and have the sass variables before the modules.
The text was updated successfully, but these errors were encountered: