Skip to content

Commit

Permalink
Fix sass_binary target build with "npm_sass_library" as external npm …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
zzzaries authored and copybara-github committed Jun 6, 2023
1 parent 325cf0a commit 949e728
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions frontend/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "npm_sass_library")
load("//defs:defs.bzl", "xprof_ng_module")

package(default_visibility = [
Expand Down Expand Up @@ -63,11 +63,9 @@ rollup_bundle(
],
)

sass_library(
name = "angular_material_theming",
srcs = [
"@npm//@angular/material"
],
npm_sass_library(
name = "angular_material_sass_deps",
deps = ["@npm//@angular/material"],
)

sass_binary(
Expand All @@ -78,11 +76,12 @@ sass_binary(
# need to include the node_modules path to enable sass to find the theming file
include_paths = [
"node_modules",
"external/npm/node_modules",
],
output_name = "styles.css",
sourcemap = False,
deps = [
":angular_material_theming",
":angular_material_sass_deps",
],
)

Expand Down

0 comments on commit 949e728

Please sign in to comment.