Theming my own components (Alpha 9)
Bug, feature request, or proposal:
Attempting to follow the guidelines for styling my own components based on Material, but simply can't get it to work, I am doing the following in the scss but it does not work. Importing theming and palette into my scss results in $primary not being found. What could I be doing wrong ? Am I not importing correctly ? How do I correctly import theming in my scss such that I can theme my own components.
At the top of my scss
@import 'node_modules/@angular/material/core/theming/_theming';
.someClass { background-color: md-color($primary); color: md-color($primary, default-contrast); // color: red; }
Then I get the following on compiling the SASS
Error: Undefined variable: "$primary"
Need Help
What is the expected behavior?
Need to be able to correctly theme my own components using material import via my scss
What is the current behavior?
Can't find $primary
What are the steps to reproduce?
Tried to pull together a plunker based on a material seed, find it here
The plunker simply will not render if the code in myComp.component.scss remains as is, if the component theming is removed with the import commented and simply setting the color to red, the page will render correctly ???
What is the use-case or motivation for changing an existing behavior?
Styling my own components based on material
Which versions of Angular, Material, OS, browsers are affected?
Ng 2.0 final Material Alpha 9
Is there anything else we should know?
no
Why is the .css needed in the first place? Angular includes the component css in each component and by importing the _theming.scss you generate your own themed .css with all the styles.
Isnt it possible to just remove those from the build?
It is meant for those who are not using sass. If you are using sass, I think you can remove it by yourself.
The problem with overlay is fixed in #1544- other than that, I think everything else should be covered by https://github.com/angular/material2/blob/master/docs/theming-your-components.md
@jelbourn Link is broken
@crosshopes New link for the theming guide is at:
https://github.com/angular/material2/blob/master/guides/theming-your-components.md.
Also available here:
https://material.angular.io/guide/theming-your-components
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.