Skip to content

Commit c734deb

Browse files
devversionmmalerba
authored andcommitted
build: update scss-bundle to avoid node-sass dependency (#17978)
The `scss-bundle` package has a dependency on `node-sass` in the older versions. This makes our tooling reliant on native bindings, and requires additionally work in framework where we integrate our tooling into a different environment setup (e.g. different node version). Regardless of that though, it's generally better not relying on node-sass or native bindings since we use `sass` (not node-sass) for building with Bazel.
1 parent 527f1b5 commit c734deb

File tree

5 files changed

+139
-96
lines changed

5 files changed

+139
-96
lines changed

BUILD.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ package(default_visibility = ["//visibility:public"])
22

33
load("//:rollup-globals.bzl", "ROLLUP_GLOBALS")
44

5-
exports_files(["LICENSE"])
5+
exports_files([
6+
"LICENSE",
7+
"scss-bundle.config.json",
8+
])
69

710
genrule(
811
name = "rollup_globals",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
"rollup-plugin-node-resolve": "^5.2.0",
148148
"rollup-plugin-sourcemaps": "^0.4.2",
149149
"run-sequence": "^1.2.2",
150-
"scss-bundle": "^2.5.1",
150+
"scss-bundle": "^3.0.2",
151151
"selenium-webdriver": "^3.6.0",
152152
"semver": "^6.3.0",
153153
"send": "^0.17.1",

scss-bundle.config.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"*1": "scss-bundle requires a config file in the Bazel execroot.",
3+
"*2": "The config is used in the src/material:theming_bundle target",
4+
"bundlerOptions": {
5+
"logLevel": "error",
6+
"dedupeGlobs": [
7+
"./src/**/*.scss"
8+
]
9+
}
10+
}

src/material/BUILD.bazel

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@ scss_bundle(
2626
name = "theming_bundle",
2727
outs = ["_theming.scss"],
2828
args = [
29-
"--entry=$(location //src/material/core:theming/_all-theme.scss)",
30-
"--verbosity=Errors",
31-
"--dedupe=./src/**/*.scss",
32-
"--dest=$(location :_theming.scss)",
29+
"--entryFile=$(location //src/material/core:theming/_all-theme.scss)",
30+
"--outFile=$(location :_theming.scss)",
31+
],
32+
data = CDK_SCSS_LIBS + MATERIAL_SCSS_LIBS + [
33+
"//src/material/core:theming/_all-theme.scss",
34+
# Config file is required by "scss-bundle" and will be automatically
35+
# loaded by the CLI. It expects the config to be in the execroot.
36+
"//:scss-bundle.config.json",
3337
],
34-
data = CDK_SCSS_LIBS + MATERIAL_SCSS_LIBS + ["//src/material/core:theming/_all-theme.scss"],
3538
)
3639

3740
# Creates the @angular/material package published to npm.

0 commit comments

Comments
 (0)