-
Notifications
You must be signed in to change notification settings - Fork 115
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
Feature request: define CSS in component file #296
Comments
Or maybe even something like export default class MyComponent extends Component {
layout = {
<style>
&__some-div { color: purple; }
</style>
<div class='{{styleNamespace}}__some-div'></div>
}
} and a Broccoli processor that pulls |
hmmmm mmm mmmmmm mmm mm .... I think you could write a separate preprocessor that moves the styles into it's own file, and just have that run before ECC. I'd have to think about what the best way to write that would be though. But it doesn't have to live in ECC. |
Those two go together nicely :) |
well.. sure. But you could use it with ember-css-modules also.. and would want it to run before that also.. |
Sorry for bumping this 😄 Perhaps it's an idea to have something like this (an I'm absolutely 100% unsure whether it's even possible with Broccoli): export default class MyComponent extends Component {
style = sass`
& {
background: palevioletred;
}
`;
layout = hbs`
<SomeOtherComponent />
`;
} I think a |
@kleiram i still think this would live better in some kind of babel plugin that was wrapped in an addon, and something that could live and be maintained in parallel to this addon. |
and the minimum of pulling out a chock of text and dumping it in a file is something that a babel or even maybe just a broccoli plugin could do with relative ease. Not getting into where you are importing methods into the js file that you are then interpolating into the sass to be later processed by a sass or equivalent preprocessor.. then you are getting into something a bit more tricky... but still possible. |
We write a lot of our components in "single-file" form:
It would be lovely to include the CSS in the same file. I don't know what that syntax would be, but borrowing an idea from Ruby, perhaps
though that would require a custom parser for editors.
The text was updated successfully, but these errors were encountered: