css-loader 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -1
- package/README.md +42 -1
- package/dist/runtime/getUrl.js +3 -0
- package/dist/utils.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [3.2.0](https://github.com/webpack-contrib/css-loader/compare/v3.1.0...v3.2.0) (2019-08-06)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* replace `.` characters in localIndent to `-` character (regression) ([#982](https://github.com/webpack-contrib/css-loader/issues/982)) ([967fb66](https://github.com/webpack-contrib/css-loader/commit/967fb66))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* support es modules for assets loader ([#984](https://github.com/webpack-contrib/css-loader/issues/984)) ([9c5126c](https://github.com/webpack-contrib/css-loader/commit/9c5126c))
|
|
16
|
+
|
|
5
17
|
## [3.1.0](https://github.com/webpack-contrib/css-loader/compare/v3.0.0...v3.1.0) (2019-07-18)
|
|
6
18
|
|
|
7
19
|
|
|
@@ -40,7 +52,7 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
40
52
|
* minimum required nodejs version is 8.9.0
|
|
41
53
|
* `@value` at rules now support in `selector`, recommends checking all `@values` at-rule usage (hint: you can add prefix to all `@value` at-rules, for example `@value v-foo: black;` or `@value m-foo: screen and (max-width: 12450px)`, and then do upgrade)
|
|
42
54
|
* invert `{Function}` behavior for `url` and `import` options (need return `true` when you want handle `url`/`@import` and return `false` if not)
|
|
43
|
-
* `
|
|
55
|
+
* `camelCase` option was remove in favor `localsConvention` option, also it is accept only `{String}` value (use `camelCase` value if you previously value was `true` and `asIs` if you previously value was `false`)
|
|
44
56
|
* `exportOnlyLocals` option was remove in favor `onlyLocals` option
|
|
45
57
|
* `modules` option now can be `{Object}` and allow to setup `CSS Modules` options:
|
|
46
58
|
* `localIdentName` option was removed in favor `modules.localIdentName` option
|
package/README.md
CHANGED
|
@@ -873,7 +873,7 @@ module.exports = {
|
|
|
873
873
|
use: ['style-loader', 'css-loader'],
|
|
874
874
|
},
|
|
875
875
|
{
|
|
876
|
-
test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)
|
|
876
|
+
test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/i,
|
|
877
877
|
loader: 'url-loader',
|
|
878
878
|
options: {
|
|
879
879
|
limit: 8192,
|
|
@@ -892,6 +892,47 @@ For production builds it's recommended to extract the CSS from your bundle being
|
|
|
892
892
|
|
|
893
893
|
- As an alternative, if seeking better development performance and css outputs that mimic production. [extract-css-chunks-webpack-plugin](https://github.com/faceyspacey/extract-css-chunks-webpack-plugin) offers a hot module reload friendly, extended version of mini-css-extract-plugin. HMR real CSS files in dev, works like mini-css in non-dev
|
|
894
894
|
|
|
895
|
+
### CSS modules and pure CSS
|
|
896
|
+
|
|
897
|
+
When you have pure CSS (without CSS modules) and CSS modules in project you can use this setup:
|
|
898
|
+
|
|
899
|
+
**webpack.config.js**
|
|
900
|
+
|
|
901
|
+
```js
|
|
902
|
+
module.exports = {
|
|
903
|
+
module: {
|
|
904
|
+
rules: [
|
|
905
|
+
{
|
|
906
|
+
// For pure CSS (without CSS modules)
|
|
907
|
+
test: /\.css$/i,
|
|
908
|
+
exclude: /\.module\.css$/i,
|
|
909
|
+
use: ['style-loader', 'css-loader'],
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
// For CSS modules
|
|
913
|
+
test: /\.module\.css$/i,
|
|
914
|
+
use: [
|
|
915
|
+
'style-loader',
|
|
916
|
+
{
|
|
917
|
+
loader: 'css-loader',
|
|
918
|
+
options: {
|
|
919
|
+
modules: true,
|
|
920
|
+
},
|
|
921
|
+
},
|
|
922
|
+
],
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/i,
|
|
926
|
+
loader: 'url-loader',
|
|
927
|
+
options: {
|
|
928
|
+
limit: 8192,
|
|
929
|
+
},
|
|
930
|
+
},
|
|
931
|
+
],
|
|
932
|
+
},
|
|
933
|
+
};
|
|
934
|
+
```
|
|
935
|
+
|
|
895
936
|
## Contributing
|
|
896
937
|
|
|
897
938
|
Please take a moment to read our contributing guidelines if you haven't yet done so.
|
package/dist/runtime/getUrl.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
module.exports = function (url, needQuotes) {
|
|
4
|
+
// eslint-disable-next-line no-underscore-dangle, no-param-reassign
|
|
5
|
+
url = url.__esModule ? url.default : url;
|
|
6
|
+
|
|
4
7
|
if (typeof url !== 'string') {
|
|
5
8
|
return url;
|
|
6
9
|
} // If url is already wrapped in quotes, remove them
|
package/dist/utils.js
CHANGED
|
@@ -106,7 +106,7 @@ function getLocalIdent(loaderContext, localIdentName, localName, options) {
|
|
|
106
106
|
// Also directories can contains invalid characters for css we need escape their too
|
|
107
107
|
|
|
108
108
|
return (0, _cssesc.default)(_loaderUtils.default.interpolateName(loaderContext, localIdentName, options) // For `[hash]` placeholder
|
|
109
|
-
.replace(/^((-?[0-9])|--)/, '_$1').replace(filenameReservedRegex, '-').replace(reControlChars, '-').replace(reRelativePath, '-'), {
|
|
109
|
+
.replace(/^((-?[0-9])|--)/, '_$1').replace(filenameReservedRegex, '-').replace(reControlChars, '-').replace(reRelativePath, '-').replace(/\./g, '-'), {
|
|
110
110
|
isIdentifier: true
|
|
111
111
|
}).replace(/\\\[local\\\]/gi, localName);
|
|
112
112
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "css-loader",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "css loader module for webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "webpack-contrib/css-loader",
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
"del": "^5.0.0",
|
|
69
69
|
"del-cli": "^2.0.0",
|
|
70
70
|
"es-check": "^5.0.0",
|
|
71
|
-
"eslint": "^
|
|
71
|
+
"eslint": "^6.1.0",
|
|
72
72
|
"eslint-config-prettier": "^6.0.0",
|
|
73
73
|
"eslint-plugin-import": "^2.18.0",
|
|
74
74
|
"file-loader": "^4.0.0",
|
|
75
75
|
"husky": "^3.0.0",
|
|
76
76
|
"jest": "^24.8.0",
|
|
77
|
-
"jest-junit": "^
|
|
77
|
+
"jest-junit": "^7.0.0",
|
|
78
78
|
"lint-staged": "^9.2.0",
|
|
79
79
|
"memory-fs": "^0.4.1",
|
|
80
80
|
"npm-run-all": "^4.1.5",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"prettier": "^1.18.2",
|
|
84
84
|
"sass": "^1.22.5",
|
|
85
85
|
"sass-loader": "^7.1.0",
|
|
86
|
-
"standard-version": "^
|
|
86
|
+
"standard-version": "^7.0.0",
|
|
87
87
|
"strip-ansi": "^5.2.0",
|
|
88
88
|
"webpack": "^4.35.0"
|
|
89
89
|
},
|