-
Notifications
You must be signed in to change notification settings - Fork 68
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
Add example of how to import from Angular Material's SASS stylesheets #98
Comments
This is the approach I took:
The editor doesn't understand the import and flags it as an issue however |
/cc @jelbourn yeah I think this is a rules_sass thing. I'll transfer the issue |
@alexeagle @jelbourn What's the current recommended way to do this? |
I actually don't know myself- @alexeagle should we be putting a |
Running into this myself. Any new information or workaround? @achew22 Can you share this vendored solution you made? |
I don't think material should publish a BUILD file because you'd want any sass library to work with Bazel. How would this work with sass outside of Bazel? I think we should make it the same. |
We just put a Sass file in the root of our package. With webpack you would just import with the tilde convention @import '~@angular/material/theming'; Should each application need to define their own |
seems like maybe you want to port that tilde feature from the webpack sass loader into sass proper? then you'd look through the third-party installed packages to resolve that. At this point people have written enough webpack-specific code that we have to treat it as standard syntax in order to interop with existing codebases I guess? |
@mattem couldn't get this to work. |
We're discussing plans for a portable package import scheme in sass/sass#2739. We probably won't end up using the same syntax as Webpack, but it should eventually solve this issue. |
I think it's unfair that you should be forced to adopt someone else's syntax, but if you don't use the same syntax as Webpack we need some plan to migrate everyone's code right? |
That's true, but the semantics are different enough anyway (e.g. the built-in importer won't support package.json-defined entrypoints) that that's probably a less painful migration than just co-opting the webpack syntax would be. |
If the migration is painful then we'll still have webpack sass imports indefinitely and we'll end up having to support them under Bazel too (I suppose maybe in a layer above rules_sass - Angular CLI can't tell all our users to do something painful when we introduce Bazel) |
I don't think migrating to |
I agree that a migration from Is there a recommended approach here? Attempted to use the output of a genrule as the src for sass_binary, but it let to other import issues. |
What is the currently recommended/best/correct approach to include external stylesheets? |
any progress on supporting the |
To enable the support I had to switch to the JavaScript API as it is already orchestrated via javascript. This enables the possibility of specifying importers that can resolve custom import paths. Fixes bazelbuild#98
any progress on this issue? |
If I understand the readme of the webpack sass-loader correctly,
|
…sass dependency As we upgraded to angular v14 now, and switched to use @use based angular material sass API, we changed the sass_binary dependency from the [_theming.scss](bazelbuild/rules_sass#98) stylesheet to @angular/material, so updating the dependency accordingly should fix the build error of "Cannot find stylesheet to import - @use '@angular/material' as mat". [stackoverflow discussion](https://stackoverflow.com/questions/70836279/integrate-material-ui-into-angular-bazel-project) PiperOrigin-RevId: 538294719
…sass dependency As we upgraded to angular v14 now, and switched to use @use based angular material sass API, we changed the sass_binary dependency from the [_theming.scss](bazelbuild/rules_sass#98) stylesheet to @angular/material, so updating the dependency accordingly should fix the build error of "Cannot find stylesheet to import - @use '@angular/material' as mat". [stackoverflow discussion](https://stackoverflow.com/questions/70836279/integrate-material-ui-into-angular-bazel-project) PiperOrigin-RevId: 538314806
🚀 feature request
It would be nice if the example's styles.css showed how to import something like
https://material.angular.io/guide/theming-your-components
Relevant Rules
This may be better as a rules_sass feature request.
Describe alternatives you've considered
I couldn't figure out how to depend on the material scss files, so I just vendored them and made a sass_library myself.
The text was updated successfully, but these errors were encountered: