Skip to content

Commit ce15899

Browse files
alan-agius4alexeagle
authored andcommitted
feat(@angular-devkit/build-angular): use sass instead of node-sass
BREAKING CHANGE: we no longer use `node-sass` by default, instead we use `sass` (dart-sass). While in most cases this should not have an impact the generated code, dart sass has some differences from Ruby Sass. See https://github.com/sass/dart-sass#behavioral-differences-from-ruby-sass for more details If you wish to use `node-sass` instead of `sass` you need to install node-sass as a dev dependency. npm users ``` npm install node-sass --save-dev ``` yarn users ``` yarn add node-sass --dev ``` **Note:** for larger Sass projects to avoid this performance hit you might want to install `fibers`. See: https://www.npmjs.com/package/fibers Ref: TOOL-748
1 parent 0a1d429 commit ce15899

File tree

3 files changed

+14
-34
lines changed

3 files changed

+14
-34
lines changed

packages/angular_devkit/build_angular/package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"postcss-loader": "3.0.0",
3535
"raw-loader": "1.0.0",
3636
"rxjs": "6.4.0",
37+
"sass": "1.17.3",
3738
"sass-loader": "7.1.0",
3839
"semver": "5.6.0",
3940
"source-map-support": "0.5.11",
@@ -52,9 +53,6 @@
5253
"webpack-sources": "1.3.0",
5354
"webpack-subresource-integrity": "1.1.0-rc.6"
5455
},
55-
"optionalDependencies": {
56-
"node-sass": "4.11.0"
57-
},
5856
"devDependencies": {
5957
"@angular/animations": "^8.0.0-beta.9",
6058
"@angular/cdk": "^7.3.4",

packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/styles.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
120120
}
121121
}
122122

123-
let dartSass: {} | undefined;
123+
let sassImplementation: {} | undefined;
124+
let fiber: {} | undefined;
124125
try {
125126
// tslint:disable-next-line:no-implicit-dependencies
126-
dartSass = require('sass');
127-
} catch { }
127+
sassImplementation = require('node-sass');
128+
} catch {
129+
sassImplementation = require('sass');
128130

129-
let fiber: {} | undefined;
130-
if (dartSass) {
131131
try {
132132
// tslint:disable-next-line:no-implicit-dependencies
133133
fiber = require('fibers');
@@ -142,7 +142,7 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
142142
use: [{
143143
loader: 'sass-loader',
144144
options: {
145-
implementation: dartSass,
145+
implementation: sassImplementation,
146146
fiber,
147147
sourceMap: cssSourceMap,
148148
// bootstrap-sass requires a minimum precision of 8

yarn.lock

+7-25
Original file line numberDiff line numberDiff line change
@@ -6367,31 +6367,6 @@ node-sass-tilde-importer@^1.0.0:
63676367
dependencies:
63686368
find-parent-dir "^0.3.0"
63696369

6370-
6371-
version "4.11.0"
6372-
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.11.0.tgz#183faec398e9cbe93ba43362e2768ca988a6369a"
6373-
integrity sha512-bHUdHTphgQJZaF1LASx0kAviPH7sGlcyNhWade4eVIpFp6tsn7SV8xNMTbsQFpEV9VXpnwTTnNYlfsZXgGgmkA==
6374-
dependencies:
6375-
async-foreach "^0.1.3"
6376-
chalk "^1.1.1"
6377-
cross-spawn "^3.0.0"
6378-
gaze "^1.0.0"
6379-
get-stdin "^4.0.1"
6380-
glob "^7.0.3"
6381-
in-publish "^2.0.0"
6382-
lodash.assign "^4.2.0"
6383-
lodash.clonedeep "^4.3.2"
6384-
lodash.mergewith "^4.6.0"
6385-
meow "^3.7.0"
6386-
mkdirp "^0.5.1"
6387-
nan "^2.10.0"
6388-
node-gyp "^3.8.0"
6389-
npmlog "^4.0.0"
6390-
request "^2.88.0"
6391-
sass-graph "^2.2.4"
6392-
stdout-stream "^1.4.0"
6393-
"true-case-path" "^1.0.2"
6394-
63956370
node-sass@^4.9.3:
63966371
version "4.9.4"
63976372
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.9.4.tgz#349bd7f1c89422ffe7e1e4b60f2055a69fbc5512"
@@ -8088,6 +8063,13 @@ [email protected]:
80888063
pify "^3.0.0"
80898064
semver "^5.5.0"
80908065

8066+
8067+
version "1.17.3"
8068+
resolved "https://registry.yarnpkg.com/sass/-/sass-1.17.3.tgz#19f9164cf8653b9fca670a64e53285272c96d192"
8069+
integrity sha512-S4vJawbrNUxJUBiHLXPYUKZCoO6cvq3/3ZFBV66a+PafTxcDEFJB+FHLDFl0P+rUfha/703ajEXMuGTYhJESkQ==
8070+
dependencies:
8071+
chokidar "^2.0.0"
8072+
80918073
sauce-connect-launcher@^1.2.4:
80928074
version "1.2.4"
80938075
resolved "https://registry.yarnpkg.com/sauce-connect-launcher/-/sauce-connect-launcher-1.2.4.tgz#8d38f85242a9fbede1b2303b559f7e20c5609a1c"

0 commit comments

Comments
 (0)