You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**[`implementation`](#implementation)**|`{Object}`|`sass`| Setup Sass implementation to use. |
110
+
|**[`sassOptions`](#sassoptions)**|`{Object\|Function}`| defaults values for Sass implementation | Options for Sass. |
111
+
|**[`sourceMap`](#sourcemap)**|`{Boolean}`|`compiler.devtool`| Enables/Disables generation of source maps. |
112
+
|**[`prependData`](#sassoptions)**|`{String\|Function}`|`undefined`| Prepends `Sass`/`SCSS` code before the actual entry file. |
113
+
|**[`webpackImporter`](#webpackimporter)**|`{Boolean}`|`true`| Enables/Disables the default Webpack importer. |
114
+
107
115
### `implementation`
108
116
117
+
Type: `Object`
109
118
Default: `sass`
110
119
111
120
The special `implementation` option determines which implementation of Sass to use.
@@ -247,6 +256,7 @@ module.exports = {
247
256
### `sassOptions`
248
257
249
258
Type: `Object|Function`
259
+
Default: defaults values for Sass implementation
250
260
251
261
Options for [Dart Sass](http://sass-lang.com/dart-sass) or [Node Sass](https://github.com/sass/node-sass) implementation.
252
262
@@ -334,19 +344,19 @@ module.exports = {
334
344
};
335
345
```
336
346
337
-
### `prependData`
347
+
### `sourceMap`
338
348
339
-
Type: `String|Function`
340
-
Default: `undefined`
349
+
Type: `Boolean`
350
+
Default: depends on the `compiler.devtool` value
341
351
342
-
Prepends `Sass`/`SCSS` code before the actual entry file.
343
-
In this case, the `sass-loader` will not override the `data` option but just append the entry's content.
352
+
Enables/Disables generation of source maps.
344
353
345
-
This is especially useful when some of your Sass variables depend on the environment:
354
+
By default generation of source maps depends on the [`devtool`](https://webpack.js.org/configuration/devtool/) option.
355
+
All values enable source map generation except `eval` and `false` value.
346
356
347
-
> ℹ Since you're injecting code, this will break the source mappings in your entry file. Often there's a simpler solution than this, like multiple Sass entry files.
357
+
> ℹ If a `true`the `sourceMap`, `sourceMapRoot`, `sourceMapEmbed`, `sourceMapContents` and `omitSourceMapUrl` from `sassOptions` will be ignored.
348
358
349
-
#### `String`
359
+
**webpack.config.js**
350
360
351
361
```js
352
362
module.exports= {
@@ -356,11 +366,16 @@ module.exports = {
356
366
test:/\.s[ac]ss$/i,
357
367
use: [
358
368
'style-loader',
359
-
'css-loader',
369
+
{
370
+
loader:'css-loader',
371
+
options: {
372
+
sourceMap:true,
373
+
},
374
+
},
360
375
{
361
376
loader:'sass-loader',
362
377
options: {
363
-
prependData:'$env: '+process.env.NODE_ENV+';',
378
+
sourceMap:true,
364
379
},
365
380
},
366
381
],
@@ -370,7 +385,10 @@ module.exports = {
370
385
};
371
386
```
372
387
373
-
#### `Function`
388
+
> ℹ In some rare cases `node-sass` can output invalid source maps (it is a `node-sass` bug).
389
+
> In order to avoid this, you can try to update `node-sass` to latest version or you can try to set within `sassOptions` the `outputStyle` option to `compressed`.
390
+
391
+
**webpack.config.js**
374
392
375
393
```js
376
394
module.exports= {
@@ -384,16 +402,9 @@ module.exports = {
384
402
{
385
403
loader:'sass-loader',
386
404
options: {
387
-
prependData: (loaderContext) => {
388
-
// More information about available properties https://webpack.js.org/api/loaders/
Prepends `Sass`/`SCSS` code before the actual entry file.
424
+
In this case, the `sass-loader` will not override the `data` option but just append the entry's content.
413
425
414
-
By default generation of source maps depends on the [`devtool`](https://webpack.js.org/configuration/devtool/) option.
415
-
All values enable source map generation except `eval` and `false` value.
426
+
This is especially useful when some of your Sass variables depend on the environment:
416
427
417
-
> ℹ If a `true`the `sourceMap`, `sourceMapRoot`, `sourceMapEmbed`, `sourceMapContents` and `omitSourceMapUrl` from `sassOptions` will be ignored.
428
+
> ℹ Since you're injecting code, this will break the source mappings in your entry file. Often there's a simpler solution than this, like multiple Sass entry files.
418
429
419
-
**webpack.config.js**
430
+
#### `String`
420
431
421
432
```js
422
433
module.exports= {
@@ -426,16 +437,11 @@ module.exports = {
426
437
test:/\.s[ac]ss$/i,
427
438
use: [
428
439
'style-loader',
429
-
{
430
-
loader:'css-loader',
431
-
options: {
432
-
sourceMap:true,
433
-
},
434
-
},
440
+
'css-loader',
435
441
{
436
442
loader:'sass-loader',
437
443
options: {
438
-
sourceMap:true,
444
+
prependData:'$env: '+process.env.NODE_ENV+';',
439
445
},
440
446
},
441
447
],
@@ -445,10 +451,7 @@ module.exports = {
445
451
};
446
452
```
447
453
448
-
> ℹ In some rare cases `node-sass` can output invalid source maps (it is a `node-sass` bug).
449
-
> In order to avoid this, you can try to update `node-sass` to latest version or you can try to set within `sassOptions` the `outputStyle` option to `compressed`.
450
-
451
-
**webpack.config.js**
454
+
#### `Function`
452
455
453
456
```js
454
457
module.exports= {
@@ -462,9 +465,16 @@ module.exports = {
462
465
{
463
466
loader:'sass-loader',
464
467
options: {
465
-
sourceMap:true,
466
-
sassOptions: {
467
-
outputStyle:'compressed',
468
+
prependData: (loaderContext) => {
469
+
// More information about available properties https://webpack.js.org/api/loaders/
This can improve performance in some cases. Use it with caution because aliases and `@import` at-rules starting with `~` will not work. You can pass own `importer` to solve this (see [`importer docs`](https://github.com/sass/node-sass#importer--v200---experimental)).
495
+
This can improve performance in some cases. Use it with caution because aliases and `@import` at-rules starting with `~` will not work.
496
+
You can pass own `importer` to solve this (see [`importer docs`](https://github.com/sass/node-sass#importer--v200---experimental)).
0 commit comments