css-loader 0.28.1 → 0.28.5
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 +41 -0
- package/README.md +5 -5
- package/lib/compile-exports.js +1 -1
- package/lib/loader.js +15 -6
- package/lib/processCss.js +16 -22
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,47 @@
|
|
|
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
|
+
<a name="0.28.5"></a>
|
|
6
|
+
## [0.28.5](https://github.com/webpack/css-loader/compare/v0.28.4...v0.28.5) (2017-08-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* match mutliple dashes (`options.camelCase`) ([#556](https://github.com/webpack/css-loader/issues/556)) ([1fee601](https://github.com/webpack/css-loader/commit/1fee601))
|
|
12
|
+
* stricter `[@import](https://github.com/import)` tolerance ([#593](https://github.com/webpack/css-loader/issues/593)) ([2e4ec09](https://github.com/webpack/css-loader/commit/2e4ec09))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<a name="0.28.4"></a>
|
|
17
|
+
## [0.28.4](https://github.com/webpack/css-loader/compare/v0.28.3...v0.28.4) (2017-05-30)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* preserve leading underscore in class names ([#543](https://github.com/webpack/css-loader/issues/543)) ([f6673c8](https://github.com/webpack/css-loader/commit/f6673c8))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
<a name="0.28.3"></a>
|
|
27
|
+
## [0.28.3](https://github.com/webpack/css-loader/compare/v0.28.2...v0.28.3) (2017-05-25)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* correct plugin order for CSS Modules ([#534](https://github.com/webpack/css-loader/issues/534)) ([b90f492](https://github.com/webpack/css-loader/commit/b90f492))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
<a name="0.28.2"></a>
|
|
37
|
+
## [0.28.2](https://github.com/webpack/css-loader/compare/v0.28.1...v0.28.2) (2017-05-22)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Bug Fixes
|
|
41
|
+
|
|
42
|
+
* source maps path on `windows` ([#532](https://github.com/webpack/css-loader/issues/532)) ([c3d0d91](https://github.com/webpack/css-loader/commit/c3d0d91))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
5
46
|
<a name="0.28.1"></a>
|
|
6
47
|
## [0.28.1](https://github.com/webpack/css-loader/compare/v0.28.0...v0.28.1) (2017-05-02)
|
|
7
48
|
|
package/README.md
CHANGED
|
@@ -27,9 +27,9 @@ The `css-loader` interprets `@import` and `url()` like `import/require()`
|
|
|
27
27
|
and will resolve them.
|
|
28
28
|
|
|
29
29
|
Good loaders for requiring your assets are the [file-loader](https://github.com/webpack/file-loader)
|
|
30
|
-
and the [url-loader](https://github.com/webpack/url-loader) which you should specify in your config (see [below](https://github.com/
|
|
30
|
+
and the [url-loader](https://github.com/webpack/url-loader) which you should specify in your config (see [below](https://github.com/webpack-contrib/css-loader#assets)).
|
|
31
31
|
|
|
32
|
-
**file.
|
|
32
|
+
**file.js**
|
|
33
33
|
```js
|
|
34
34
|
import css from 'file.css';
|
|
35
35
|
```
|
|
@@ -103,6 +103,7 @@ It's useful when you, for instance, need to post process the CSS as a string.
|
|
|
103
103
|
|**`sourceMap`**|`{Boolean}`|`false`|Enable/Disable Sourcemaps|
|
|
104
104
|
|**`camelCase`**|`{Boolean\|String}`|`false`|Export Classnames in CamelCase|
|
|
105
105
|
|**`importLoaders`**|`{Number}`|`0`|Number of loaders applied before CSS loader|
|
|
106
|
+
|**`localIdentName`**|`{String}`|`[hash:base64]`|Configure the generated ident|
|
|
106
107
|
|
|
107
108
|
### `root`
|
|
108
109
|
|
|
@@ -342,7 +343,7 @@ To import from multiple modules use multiple `composes:` rules.
|
|
|
342
343
|
|
|
343
344
|
By default the css-loader minimizes the css if specified by the module system.
|
|
344
345
|
|
|
345
|
-
In some cases the minification is destructive to the css, so you can provide your own options to the minifier if needed.
|
|
346
|
+
In some cases the minification is destructive to the css, so you can provide your own options to the cssnano-based minifier if needed. See [cssnano's documentation](http://cssnano.co/guides/) for more information on the available options.
|
|
346
347
|
|
|
347
348
|
You can also disable or enforce minification with the `minimize` query parameter.
|
|
348
349
|
|
|
@@ -473,7 +474,7 @@ module.exports = {
|
|
|
473
474
|
test: /\.css$/,
|
|
474
475
|
use: env === 'production'
|
|
475
476
|
? ExtractTextPlugin.extract({
|
|
476
|
-
fallback: 'style-loader'
|
|
477
|
+
fallback: 'style-loader',
|
|
477
478
|
use: [ 'css-loader' ]
|
|
478
479
|
})
|
|
479
480
|
: [ 'style-loader', 'css-loader' ]
|
|
@@ -487,7 +488,6 @@ module.exports = {
|
|
|
487
488
|
})
|
|
488
489
|
]
|
|
489
490
|
: []
|
|
490
|
-
]
|
|
491
491
|
}
|
|
492
492
|
```
|
|
493
493
|
|
package/lib/compile-exports.js
CHANGED
package/lib/loader.js
CHANGED
|
@@ -20,8 +20,17 @@ module.exports = function(content, map) {
|
|
|
20
20
|
var resolve = createResolver(query.alias);
|
|
21
21
|
|
|
22
22
|
if(sourceMap) {
|
|
23
|
-
if (map
|
|
24
|
-
map
|
|
23
|
+
if (map) {
|
|
24
|
+
if (typeof map === "string") {
|
|
25
|
+
map = JSON.stringify(map);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (map.sources) {
|
|
29
|
+
map.sources = map.sources.map(function (source) {
|
|
30
|
+
return source.replace(/\\/g, '/');
|
|
31
|
+
});
|
|
32
|
+
map.sourceRoot = '';
|
|
33
|
+
}
|
|
25
34
|
}
|
|
26
35
|
} else {
|
|
27
36
|
// Some loaders (example `"postcss-loader": "1.x.x"`) always generates source map, we should remove it
|
|
@@ -30,8 +39,8 @@ module.exports = function(content, map) {
|
|
|
30
39
|
|
|
31
40
|
processCss(content, map, {
|
|
32
41
|
mode: moduleMode ? "local" : "global",
|
|
33
|
-
from: loaderUtils.getRemainingRequest(this),
|
|
34
|
-
to: loaderUtils.getCurrentRequest(this),
|
|
42
|
+
from: loaderUtils.getRemainingRequest(this).split("!").pop(),
|
|
43
|
+
to: loaderUtils.getCurrentRequest(this).split("!").pop(),
|
|
35
44
|
query: query,
|
|
36
45
|
minimize: this.minimize,
|
|
37
46
|
loaderContext: this,
|
|
@@ -105,11 +114,11 @@ module.exports = function(content, map) {
|
|
|
105
114
|
map = result.map;
|
|
106
115
|
if(map.sources) {
|
|
107
116
|
map.sources = map.sources.map(function(source) {
|
|
108
|
-
return source.split("!").pop();
|
|
117
|
+
return source.split("!").pop().replace(/\\/g, '/');
|
|
109
118
|
}, this);
|
|
110
119
|
map.sourceRoot = "";
|
|
111
120
|
}
|
|
112
|
-
map.file = map.file.split("!").pop();
|
|
121
|
+
map.file = map.file.split("!").pop().replace(/\\/g, '/');
|
|
113
122
|
map = JSON.stringify(map);
|
|
114
123
|
moduleJs = "exports.push([module.id, " + cssAsString + ", \"\", " + map + "]);";
|
|
115
124
|
} else {
|
package/lib/processCss.js
CHANGED
|
@@ -9,6 +9,7 @@ var loaderUtils = require("loader-utils");
|
|
|
9
9
|
var assign = require("object-assign");
|
|
10
10
|
var getLocalIdent = require("./getLocalIdent");
|
|
11
11
|
|
|
12
|
+
var icssUtils = require('icss-utils');
|
|
12
13
|
var localByDefault = require("postcss-modules-local-by-default");
|
|
13
14
|
var extractImports = require("postcss-modules-extract-imports");
|
|
14
15
|
var modulesScope = require("postcss-modules-scope");
|
|
@@ -41,14 +42,14 @@ var parserPlugin = postcss.plugin("css-loader-parser", function(options) {
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
if(options.import) {
|
|
44
|
-
css.walkAtRules(
|
|
45
|
+
css.walkAtRules(/^import$/i, function(rule) {
|
|
45
46
|
var values = Tokenizer.parseValues(rule.params);
|
|
46
47
|
var url = values.nodes[0].nodes[0];
|
|
47
|
-
if(url.type === "url") {
|
|
48
|
+
if(url && url.type === "url") {
|
|
48
49
|
url = url.url;
|
|
49
|
-
} else if(url.type === "string") {
|
|
50
|
+
} else if(url && url.type === "string") {
|
|
50
51
|
url = url.value;
|
|
51
|
-
} else throw rule.error("Unexpected format" + rule.params);
|
|
52
|
+
} else throw rule.error("Unexpected format " + rule.params);
|
|
52
53
|
if (!url.replace(/\s/g, '').length) {
|
|
53
54
|
return;
|
|
54
55
|
}
|
|
@@ -65,24 +66,17 @@ var parserPlugin = postcss.plugin("css-loader-parser", function(options) {
|
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
rule.walkDecls(function(decl) {
|
|
78
|
-
imports["$" + decl.prop] = importItems.length;
|
|
79
|
-
importItems.push({
|
|
80
|
-
url: url,
|
|
81
|
-
export: decl.value
|
|
82
|
-
});
|
|
69
|
+
var icss = icssUtils.extractICSS(css);
|
|
70
|
+
exports = icss.icssExports;
|
|
71
|
+
Object.keys(icss.icssImports).forEach(function(key) {
|
|
72
|
+
var url = loaderUtils.parseString(key);
|
|
73
|
+
Object.keys(icss.icssImports[key]).forEach(function(prop) {
|
|
74
|
+
imports["$" + prop] = importItems.length;
|
|
75
|
+
importItems.push({
|
|
76
|
+
url: url,
|
|
77
|
+
export: icss.icssImports[key][prop]
|
|
83
78
|
});
|
|
84
|
-
|
|
85
|
-
}
|
|
79
|
+
})
|
|
86
80
|
});
|
|
87
81
|
|
|
88
82
|
Object.keys(exports).forEach(function(exportName) {
|
|
@@ -159,6 +153,7 @@ module.exports = function processCss(inputSource, inputMap, options, callback) {
|
|
|
159
153
|
};
|
|
160
154
|
|
|
161
155
|
var pipeline = postcss([
|
|
156
|
+
modulesValues,
|
|
162
157
|
localByDefault({
|
|
163
158
|
mode: options.mode,
|
|
164
159
|
rewriteUrl: function(global, url) {
|
|
@@ -176,7 +171,6 @@ module.exports = function processCss(inputSource, inputMap, options, callback) {
|
|
|
176
171
|
}
|
|
177
172
|
}),
|
|
178
173
|
extractImports(),
|
|
179
|
-
modulesValues,
|
|
180
174
|
modulesScope({
|
|
181
175
|
generateScopedName: function generateScopedName (exportName) {
|
|
182
176
|
return customGetLocalIdent(options.loaderContext, localIdentName, exportName, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "css-loader",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.5",
|
|
4
4
|
"author": "Tobias Koppers @sokra",
|
|
5
5
|
"description": "css loader module for webpack",
|
|
6
6
|
"engines": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"babel-code-frame": "^6.11.0",
|
|
16
16
|
"css-selector-tokenizer": "^0.7.0",
|
|
17
17
|
"cssnano": ">=2.6.1 <4",
|
|
18
|
+
"icss-utils": "^2.1.0",
|
|
18
19
|
"loader-utils": "^1.0.2",
|
|
19
20
|
"lodash.camelcase": "^4.3.0",
|
|
20
21
|
"object-assign": "^4.0.1",
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
"postcss-modules-scope": "^1.0.0",
|
|
25
26
|
"postcss-modules-values": "^1.1.0",
|
|
26
27
|
"postcss-value-parser": "^3.3.0",
|
|
27
|
-
"source-list-map": "^0.
|
|
28
|
+
"source-list-map": "^2.0.0"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"codecov": "^1.0.1",
|