Skip to content

Commit

Permalink
refactor: charset option
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Sep 7, 2021
1 parent 634e561 commit c1f7c2b
Show file tree
Hide file tree
Showing 13 changed files with 9,335 additions and 6,763 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,13 @@ Default: defaults values for Sass implementation

Options for [Dart Sass](http://sass-lang.com/dart-sass) or [Node Sass](https://github.com/sass/node-sass) implementation.

> ℹ️ The `charset` option has `true` value by default for `dart-sass`, we strongly discourage change value to `false`, because webpack doesn't support files other than `utf-8`.
> ℹ️ The `indentedSyntax` option has `true` value for the `sass` extension.
> ℹ️ Options such as `data` and `file` are unavailable and will be ignored.
> ℹ We recommend not to set the `outFile`, `sourceMapContents`, `sourceMapEmbed`, `sourceMapRoot` options because `sass-loader` automatically sets these options when the `sourceMap` option is `true`.
> ℹ We strongly discourage change `outFile`, `sourceMapContents`, `sourceMapEmbed`, `sourceMapRoot` options because `sass-loader` automatically sets these options when the `sourceMap` option is `true`.
> ℹ️ Access to the [loader context](https://webpack.js.org/api/loaders/#the-loader-context) inside the custom importer can be done using the `this.webpackLoaderContext` property.
Expand Down
5,716 changes: 2,536 additions & 3,180 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@
"@babel/cli": "^7.14.5",
"@babel/core": "^7.14.6",
"@babel/preset-env": "^7.14.7",
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"@commitlint/cli": "^13.1.0",
"@commitlint/config-conventional": "^13.1.0",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-jest": "^27.0.6",
"bootstrap-sass": "^3.4.1",
"bootstrap-v4": "npm:bootstrap@^4.5.3",
"bootstrap-v5": "npm:bootstrap@^5.0.1",
"cross-env": "^7.0.3",
"css-loader": "^5.2.7",
"css-loader": "^6.2.0",
"del": "^6.0.0",
"del-cli": "^3.0.1",
"del-cli": "^4.0.1",
"enhanced-resolve": "^5.8.2",
"eslint": "^7.30.0",
"eslint-config-prettier": "^8.3.0",
Expand All @@ -92,7 +92,7 @@
"sass": "^1.35.2",
"semver": "^7.3.5",
"standard-version": "^9.3.1",
"style-loader": "^2.0.0",
"style-loader": "^3.2.1",
"webpack": "^5.45.1"
},
"keywords": [
Expand Down
9 changes: 8 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ async function getSassOptions(
: content;

// opt.outputStyle
if (!options.outputStyle && isProductionLikeMode(loaderContext)) {
if (
typeof options.outputStyle === "undefined" &&
isProductionLikeMode(loaderContext)
) {
options.outputStyle = "compressed";
}

Expand Down Expand Up @@ -224,6 +227,10 @@ async function getSassOptions(
: []
);

if (typeof options.charset === "undefined") {
options.charset = true;
}

return options;
}

Expand Down
Loading

0 comments on commit c1f7c2b

Please sign in to comment.