refactor(bazel): use multi_sass_binary rule (#28669)
`multi_sass_binary` rules is reinstated in rules_sass v1.17.0 and it is a better solution than list comprehension currently used because it handles imports correctly. PR Close #28669
This commit is contained in:
parent
06ec95f2ef
commit
0c7581da89
|
@ -5,16 +5,12 @@ load("@build_bazel_rules_karma//:defs.bzl", "ts_web_test_suite")
|
|||
load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle", "history_server")
|
||||
load("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl", "web_package")
|
||||
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver", "ts_library")
|
||||
<% if (sass) { %>load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
|
||||
<% if (sass) { %>load("@io_bazel_rules_sass//:defs.bzl", "multi_sass_binary")
|
||||
|
||||
[
|
||||
sass_binary(
|
||||
name = "style_" + x,
|
||||
src = x,
|
||||
deps = [],
|
||||
multi_sass_binary(
|
||||
name = "styles",
|
||||
srcs = glob(["**/*.scss"]),
|
||||
)
|
||||
for x in glob(["**/*.scss"])
|
||||
]
|
||||
<% } %>
|
||||
ng_module(
|
||||
name = "src",
|
||||
|
@ -30,7 +26,7 @@ ng_module(
|
|||
assets = glob([
|
||||
"**/*.css",
|
||||
"**/*.html",
|
||||
])<% if (sass) { %> + [":style_" + x for x in glob(["**/*.scss"])]<% } %>,
|
||||
])<% if (sass) { %> + [":styles"]<% } %>,
|
||||
deps = [
|
||||
"@angular//packages/core",
|
||||
"@angular//packages/platform-browser",<% if (routing) { %>
|
||||
|
|
|
@ -95,7 +95,7 @@ export default function(options: BazelWorkspaceOptions): Rule {
|
|||
'ANGULAR_VERSION': existingVersions.Angular || clean(latestVersions.Angular),
|
||||
'RXJS_VERSION': existingVersions.RxJs || clean(latestVersions.RxJs),
|
||||
// TODO(kyliau): Consider moving this to latest-versions.ts
|
||||
'RULES_SASS_VERSION': '1.15.1',
|
||||
'RULES_SASS_VERSION': '1.17.0',
|
||||
};
|
||||
|
||||
return mergeWith(apply(url('./files'), [
|
||||
|
|
|
@ -100,9 +100,9 @@ describe('Bazel-workspace Schematic', () => {
|
|||
'load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")');
|
||||
});
|
||||
|
||||
it('should add sass_binary rules in src/BUILD', () => {
|
||||
it('should add multi_sass_binary rule in src/BUILD', () => {
|
||||
const content = host.readContent('/src/BUILD.bazel');
|
||||
expect(content).toContain('load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")');
|
||||
expect(content).toContain('load("@io_bazel_rules_sass//:defs.bzl", "multi_sass_binary")');
|
||||
expect(content).toContain('glob(["**/*.scss"])');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue