css-loader 0.28.9 → 1.0.1

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 CHANGED
@@ -2,6 +2,53 @@
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="1.0.1"></a>
6
+ ## [1.0.1](https://github.com/webpack-contrib/css-loader/compare/v1.0.0...v1.0.1) (2018-10-29)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **loader:** trim unquoted import urls ([#783](https://github.com/webpack-contrib/css-loader/issues/783)) ([21fcddf](https://github.com/webpack-contrib/css-loader/commit/21fcddf))
12
+
13
+
14
+
15
+ <a name="1.0.0"></a>
16
+ # [1.0.0](https://github.com/webpack-contrib/css-loader/compare/v0.28.11...v1.0.0) (2018-07-06)
17
+
18
+
19
+ ### BREAKING CHANGES
20
+
21
+ * remove `minimize` option, use [`postcss-loader`](https://github.com/postcss/postcss-loader) with [`cssnano`](https://github.com/cssnano/cssnano) or use [`optimize-cssnano-plugin`](https://github.com/intervolga/optimize-cssnano-plugin) plugin
22
+ * remove `module` option, use `modules` option instead
23
+ * remove `camelcase` option, use `camelCase` option instead
24
+ * remove `root` option, use [`postcss-loader`](https://github.com/postcss/postcss-loader) with [`postcss-url`](https://github.com/postcss/postcss-url) plugin
25
+ * remove `alias` option, use [`resolve.alias`](https://webpack.js.org/configuration/resolve/) feature or use [`postcss-loader`](https://github.com/postcss/postcss-loader) with [`postcss-url`](https://github.com/postcss/postcss-url) plugin
26
+ * update `postcss` to `6` version
27
+ * minimum require `nodejs` version is `6.9`
28
+ * minimum require `webpack` version is `4`
29
+
30
+
31
+
32
+ <a name="0.28.11"></a>
33
+ ## [0.28.11](https://github.com/webpack-contrib/css-loader/compare/v0.28.10...v0.28.11) (2018-03-16)
34
+
35
+
36
+ ### Bug Fixes
37
+
38
+ * **lib/processCss:** don't check `mode` for `url` handling (`options.modules`) ([#698](https://github.com/webpack-contrib/css-loader/issues/698)) ([c788450](https://github.com/webpack-contrib/css-loader/commit/c788450))
39
+
40
+
41
+
42
+ <a name="0.28.10"></a>
43
+ ## [0.28.10](https://github.com/webpack-contrib/css-loader/compare/v0.28.9...v0.28.10) (2018-02-22)
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * **getLocalIdent:** add `rootContext` support (`webpack >= v4.0.0`) ([#681](https://github.com/webpack-contrib/css-loader/issues/681)) ([9f876d2](https://github.com/webpack-contrib/css-loader/commit/9f876d2))
49
+
50
+
51
+
5
52
  <a name="0.28.9"></a>
6
53
  ## [0.28.9](https://github.com/webpack-contrib/css-loader/compare/v0.28.8...v0.28.9) (2018-01-17)
7
54
 
package/README.md CHANGED
@@ -50,7 +50,7 @@ module.exports = {
50
50
 
51
51
  ### `toString`
52
52
 
53
- You can also use the css-loader results directly as string, such as in Angular's component style.
53
+ You can also use the css-loader results directly as a string, such as in Angular's component style.
54
54
 
55
55
  **webpack.config.js**
56
56
  ```js
@@ -94,37 +94,13 @@ It's useful when you, for instance, need to post process the CSS as a string.
94
94
 
95
95
  |Name|Type|Default|Description|
96
96
  |:--:|:--:|:-----:|:----------|
97
- |**[`root`](#root)**|`{String}`|`/`|Path to resolve URLs, URLs starting with `/` will not be translated|
98
97
  |**[`url`](#url)**|`{Boolean}`|`true`| Enable/Disable `url()` handling|
99
- |**[`alias`](#alias)**|`{Object}`|`{}`|Create aliases to import certain modules more easily|
100
98
  |**[`import`](#import)** |`{Boolean}`|`true`| Enable/Disable @import handling|
101
99
  |**[`modules`](#modules)**|`{Boolean}`|`false`|Enable/Disable CSS Modules|
102
- |**[`minimize`](#minimize)**|`{Boolean\|Object}`|`false`|Enable/Disable minification|
100
+ |**[`localIdentName`](#localidentname)**|`{String}`|`[hash:base64]`|Configure the generated ident|
103
101
  |**[`sourceMap`](#sourcemap)**|`{Boolean}`|`false`|Enable/Disable Sourcemaps|
104
102
  |**[`camelCase`](#camelcase)**|`{Boolean\|String}`|`false`|Export Classnames in CamelCase|
105
103
  |**[`importLoaders`](#importloaders)**|`{Number}`|`0`|Number of loaders applied before CSS loader|
106
- |**`localIdentName`**|`{String}`|`[hash:base64]`|Configure the generated ident|
107
-
108
- ### `root`
109
-
110
- For URLs that start with a `/`, the default behavior is to not translate them.
111
-
112
- `url(/image.png) => url(/image.png)`
113
-
114
- If a `root` query parameter is set, however, it will be prepended to the URL
115
- and then translated.
116
-
117
- **webpack.config.js**
118
- ```js
119
- {
120
- loader: 'css-loader',
121
- options: { root: '.' }
122
- }
123
- ```
124
-
125
- `url(/image.png)` => `require('./image.png')`
126
-
127
- Using 'Root-relative' urls is not recommended. You should only use it for legacy CSS files.
128
104
 
129
105
  ### `url`
130
106
 
@@ -137,48 +113,6 @@ url(image.png) => require('./image.png')
137
113
  url(~module/image.png) => require('module/image.png')
138
114
  ```
139
115
 
140
- ### `alias`
141
-
142
- Rewrite your urls with alias, this is useful when it's hard to change url paths of your input files, for example, when you're using some css / sass files in another package (bootstrap, ratchet, font-awesome, etc.).
143
-
144
- `css-loader`'s `alias` follows the same syntax as webpack's `resolve.alias`, you can see the details at the [resolve docs](https://webpack.js.org/configuration/resolve/#resolve-alias)
145
-
146
- **file.scss**
147
- ```css
148
- @charset "UTF-8";
149
- @import "bootstrap";
150
- ```
151
-
152
- **webpack.config.js**
153
- ```js
154
- {
155
- test: /\.scss$/,
156
- use: [
157
- {
158
- loader: "style-loader"
159
- },
160
- {
161
- loader: "css-loader",
162
- options: {
163
- alias: {
164
- "../fonts/bootstrap": "bootstrap-sass/assets/fonts/bootstrap"
165
- }
166
- }
167
- },
168
- {
169
- loader: "sass-loader",
170
- options: {
171
- includePaths: [
172
- path.resolve("./node_modules/bootstrap-sass/assets/stylesheets")
173
- ]
174
- }
175
- }
176
- ]
177
- }
178
- ```
179
-
180
- Check out this [working bootstrap example](https://github.com/bbtfr/webpack2-bootstrap-sass-sample).
181
-
182
116
  ### `import`
183
117
 
184
118
  To disable `@import` resolving by `css-loader` set the option to `false`
@@ -203,7 +137,7 @@ The syntax `:local(.className)` can be used to declare `className` in the local
203
137
 
204
138
  With `:local` (without brackets) local mode can be switched on for this selector. `:global(.className)` can be used to declare an explicit global selector. With `:global` (without brackets) global mode can be switched on for this selector.
205
139
 
206
- The loader replaces local selectors with unique identifiers. The choosen unique identifiers are exported by the module.
140
+ The loader replaces local selectors with unique identifiers. The chosen unique identifiers are exported by the module.
207
141
 
208
142
  ```css
209
143
  :local(.className) { background: red; }
@@ -219,7 +153,7 @@ The loader replaces local selectors with unique identifiers. The choosen unique
219
153
  ._23_aKvs-b8bW2Vg3fwHozO ._13LGdX8RMStbBE9w-t0gZ1 .global-class-name { color: blue; }
220
154
  ```
221
155
 
222
- > :information_source: Identifiers are exported
156
+ > ℹ️ Identifiers are exported
223
157
 
224
158
  ```js
225
159
  exports.locals = {
@@ -228,7 +162,7 @@ exports.locals = {
228
162
  }
229
163
  ```
230
164
 
231
- CamelCase is recommended for local selectors. They are easier to use in the within the imported JS module.
165
+ CamelCase is recommended for local selectors. They are easier to use within the imported JS module.
232
166
 
233
167
  `url()` URLs in block scoped (`:local .abc`) rules behave like requests in modules.
234
168
 
@@ -238,41 +172,6 @@ file.png => ./file.png
238
172
  ```
239
173
 
240
174
  You can use `:local(#someId)`, but this is not recommended. Use classes instead of ids.
241
- You can configure the generated ident with the `localIdentName` query parameter (default `[hash:base64]`).
242
-
243
- **webpack.config.js**
244
- ```js
245
- {
246
- test: /\.css$/,
247
- use: [
248
- {
249
- loader: 'css-loader',
250
- options: {
251
- modules: true,
252
- localIdentName: '[path][name]__[local]--[hash:base64:5]'
253
- }
254
- }
255
- ]
256
- }
257
- ```
258
-
259
- You can also specify the absolute path to your custom `getLocalIdent` function to generate classname based on a different schema. This requires `webpack >= 2.2.1` (it supports functions in the `options` object).
260
-
261
- **webpack.config.js**
262
- ```js
263
- {
264
- loader: 'css-loader',
265
- options: {
266
- modules: true,
267
- localIdentName: '[path][name]__[local]--[hash:base64:5]',
268
- getLocalIdent: (context, localIdentName, localName, options) => {
269
- return 'whatever_random_class_name'
270
- }
271
- }
272
- }
273
- ```
274
-
275
- > :information_source: For prerendering with extract-text-webpack-plugin you should use `css-loader/locals` instead of `style-loader!css-loader` **in the prerendering bundle**. It doesn't embed CSS but only exports the identifier mappings.
276
175
 
277
176
  #### `Composing`
278
177
 
@@ -339,31 +238,51 @@ To import from multiple modules use multiple `composes:` rules.
339
238
  }
340
239
  ```
341
240
 
342
- ### `minimize`
241
+ ### `localIdentName`
343
242
 
344
- By default the css-loader minimizes the css if specified by the module system.
243
+ You can configure the generated ident with the `localIdentName` query parameter. See [loader-utils's documentation](https://github.com/webpack/loader-utils#interpolatename) for more information on options.
345
244
 
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.
245
+ **webpack.config.js**
246
+ ```js
247
+ {
248
+ test: /\.css$/,
249
+ use: [
250
+ {
251
+ loader: 'css-loader',
252
+ options: {
253
+ modules: true,
254
+ localIdentName: '[path][name]__[local]--[hash:base64:5]'
255
+ }
256
+ }
257
+ ]
258
+ }
259
+ ```
347
260
 
348
- You can also disable or enforce minification with the `minimize` query parameter.
261
+ You can also specify the absolute path to your custom `getLocalIdent` function to generate classname based on a different schema. This requires `webpack >= 2.2.1` (it supports functions in the `options` object).
349
262
 
350
263
  **webpack.config.js**
351
264
  ```js
352
265
  {
353
266
  loader: 'css-loader',
354
267
  options: {
355
- minimize: true || {/* CSSNano Options */}
268
+ modules: true,
269
+ localIdentName: '[path][name]__[local]--[hash:base64:5]',
270
+ getLocalIdent: (context, localIdentName, localName, options) => {
271
+ return 'whatever_random_class_name'
272
+ }
356
273
  }
357
274
  }
358
275
  ```
359
276
 
277
+ > ℹ️ For prerendering with extract-text-webpack-plugin you should use `css-loader/locals` instead of `style-loader!css-loader` **in the prerendering bundle**. It doesn't embed CSS but only exports the identifier mappings.
278
+
360
279
  ### `sourceMap`
361
280
 
362
281
  To include source maps set the `sourceMap` option.
363
282
 
364
- I. e. the extract-text-webpack-plugin can handle them.
283
+ I.e. the extract-text-webpack-plugin can handle them.
365
284
 
366
- They are not enabled by default because they expose a runtime overhead and increase in bundle size (JS source maps do not). In addition to that relative paths are buggy and you need to use an absolute public path which include the server URL.
285
+ They are not enabled by default because they expose a runtime overhead and increase in bundle size (JS source maps do not). In addition to that relative paths are buggy and you need to use an absolute public path which includes the server URL.
367
286
 
368
287
  **webpack.config.js**
369
288
  ```js
@@ -408,7 +327,7 @@ import { className } from 'file.css';
408
327
 
409
328
  ### `importLoaders`
410
329
 
411
- The query parameter `importLoaders` allows to configure how many loaders before `css-loader` should be applied to `@import`ed resources.
330
+ The query parameter `importLoaders` allows you to configure how many loaders before `css-loader` should be applied to `@import`ed resources.
412
331
 
413
332
  **webpack.config.js**
414
333
  ```js
@@ -428,7 +347,7 @@ The query parameter `importLoaders` allows to configure how many loaders before
428
347
  }
429
348
  ```
430
349
 
431
- This may change in the future, when the module system (i. e. webpack) supports loader matching by origin.
350
+ This may change in the future when the module system (i. e. webpack) supports loader matching by origin.
432
351
 
433
352
  <h2 align="center">Examples</h2>
434
353
 
@@ -459,37 +378,8 @@ module.exports = {
459
378
 
460
379
  ### Extract
461
380
 
462
- For production builds it's recommended to extract the CSS from your bundle being able to use parallel loading of CSS/JS resources later on. This can be achieved by using the [extract-text-webpack-plugin](https://github.com/webpack-contrib/extract-text-webpack-plugin) to extract the CSS when running in production mode.
463
-
464
- **webpack.config.js**
465
- ```js
466
- const env = process.env.NODE_ENV
467
-
468
- const ExtractTextPlugin = require('extract-text-webpack-plugin')
469
-
470
- module.exports = {
471
- module: {
472
- rules: [
473
- {
474
- test: /\.css$/,
475
- use: env === 'production'
476
- ? ExtractTextPlugin.extract({
477
- fallback: 'style-loader',
478
- use: [ 'css-loader' ]
479
- })
480
- : [ 'style-loader', 'css-loader' ]
481
- },
482
- ]
483
- },
484
- plugins: env === 'production'
485
- ? [
486
- new ExtractTextPlugin({
487
- filename: '[name].css'
488
- })
489
- ]
490
- : []
491
- }
492
- ```
381
+ For production builds it's recommended to extract the CSS from your bundle being able to use parallel loading of CSS/JS resources later on.
382
+ This can be achieved by using the [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) to extract the CSS when running in production mode.
493
383
 
494
384
  <h2 align="center">Maintainers</h2>
495
385
 
@@ -1,4 +1,4 @@
1
- var camelCase = require("lodash.camelcase");
1
+ var camelCase = require("lodash/camelCase");
2
2
 
3
3
  function dashesCamelCase(str) {
4
4
  return str.replace(/-+(\w)/g, function(match, firstLetter) {
@@ -6,8 +6,15 @@ var loaderUtils = require("loader-utils");
6
6
  var path = require("path");
7
7
 
8
8
  module.exports = function getLocalIdent(loaderContext, localIdentName, localName, options) {
9
- if(!options.context)
10
- options.context = loaderContext.options && typeof loaderContext.options.context === "string" ? loaderContext.options.context : loaderContext.context;
9
+ if(!options.context) {
10
+ if (loaderContext.rootContext) {
11
+ options.context = loaderContext.rootContext;
12
+ } else if (loaderContext.options && typeof loaderContext.options.context === "string") {
13
+ options.context = loaderContext.options.context;
14
+ } else {
15
+ options.context = loaderContext.context;
16
+ }
17
+ }
11
18
  var request = path.relative(options.context, loaderContext.resourcePath);
12
19
  options.content = options.hashPrefix + request + "+" + localName;
13
20
  localIdentName = localIdentName.replace(/\[local\]/gi, localName);
package/lib/loader.js CHANGED
@@ -6,18 +6,14 @@ var loaderUtils = require("loader-utils");
6
6
  var processCss = require("./processCss");
7
7
  var getImportPrefix = require("./getImportPrefix");
8
8
  var compileExports = require("./compile-exports");
9
- var createResolver = require("./createResolver");
10
9
 
11
10
 
12
11
  module.exports = function(content, map) {
13
- if(this.cacheable) this.cacheable();
14
12
  var callback = this.async();
15
13
  var query = loaderUtils.getOptions(this) || {};
16
- var root = query.root;
17
- var moduleMode = query.modules || query.module;
18
- var camelCaseKeys = query.camelCase || query.camelcase;
14
+ var moduleMode = query.modules;
15
+ var camelCaseKeys = query.camelCase;
19
16
  var sourceMap = query.sourceMap || false;
20
- var resolve = createResolver(query.alias);
21
17
 
22
18
  if(sourceMap) {
23
19
  if (map) {
@@ -42,8 +38,6 @@ module.exports = function(content, map) {
42
38
  from: loaderUtils.getRemainingRequest(this).split("!").pop(),
43
39
  to: loaderUtils.getCurrentRequest(this).split("!").pop(),
44
40
  query: query,
45
- resolve: resolve,
46
- minimize: this.minimize,
47
41
  loaderContext: this,
48
42
  sourceMap: sourceMap
49
43
  }, function(err, result) {
@@ -55,7 +49,11 @@ module.exports = function(content, map) {
55
49
  var importUrlPrefix = getImportPrefix(this, query);
56
50
 
57
51
  var alreadyImported = {};
58
- var importJs = result.importItems.filter(function(imp) {
52
+ var importJs = result.importItems.map(function(imp) {
53
+ // fixes #781 when importing `url(filename.css )`
54
+ imp.url = imp.url.trim();
55
+ return imp;
56
+ }).filter(function(imp) {
59
57
  if(!imp.mediaQuery) {
60
58
  if(alreadyImported[imp.url])
61
59
  return false;
@@ -63,7 +61,7 @@ module.exports = function(content, map) {
63
61
  }
64
62
  return true;
65
63
  }).map(function(imp) {
66
- if(!loaderUtils.isUrlRequest(imp.url, root)) {
64
+ if(!loaderUtils.isUrlRequest(imp.url)) {
67
65
  return "exports.push([module.id, " +
68
66
  JSON.stringify("@import url(" + imp.url + ");") + ", " +
69
67
  JSON.stringify(imp.mediaQuery) + "]);";
@@ -94,7 +92,7 @@ module.exports = function(content, map) {
94
92
  var match = result.urlItemRegExp.exec(item);
95
93
  var idx = +match[1];
96
94
  var urlItem = result.urlItems[idx];
97
- var url = resolve(urlItem.url);
95
+ var url = urlItem.url;
98
96
  idx = url.indexOf("?#");
99
97
  if(idx < 0) idx = url.indexOf("#");
100
98
  var urlRequest;
@@ -108,7 +106,7 @@ module.exports = function(content, map) {
108
106
  return "\" + escape(require(" + loaderUtils.stringifyRequest(this, urlRequest) + ")) + \"";
109
107
  }.bind(this));
110
108
  }
111
-
109
+
112
110
  var exportJs = compileExports(result, importItemMatcher.bind(this), camelCaseKeys);
113
111
  if (exportJs) {
114
112
  exportJs = "exports.locals = " + exportJs + ";";
@@ -6,23 +6,18 @@ var loaderUtils = require("loader-utils");
6
6
  var processCss = require("./processCss");
7
7
  var getImportPrefix = require("./getImportPrefix");
8
8
  var compileExports = require("./compile-exports");
9
- var createResolver = require("./createResolver");
10
9
 
11
10
 
12
11
  module.exports = function(content) {
13
- if(this.cacheable) this.cacheable();
14
12
  var callback = this.async();
15
13
  var query = loaderUtils.getOptions(this) || {};
16
- var moduleMode = query.modules || query.module;
17
- var camelCaseKeys = query.camelCase || query.camelcase;
18
- var resolve = createResolver(query.alias);
14
+ var moduleMode = query.modules;
15
+ var camelCaseKeys = query.camelCase;
19
16
 
20
17
  processCss(content, null, {
21
18
  mode: moduleMode ? "local" : "global",
22
19
  query: query,
23
- minimize: this.minimize,
24
20
  loaderContext: this,
25
- resolve: resolve
26
21
  }, function(err, result) {
27
22
  if(err) return callback(err);
28
23
 
package/lib/processCss.js CHANGED
@@ -6,7 +6,6 @@ var formatCodeFrame = require("babel-code-frame");
6
6
  var Tokenizer = require("css-selector-tokenizer");
7
7
  var postcss = require("postcss");
8
8
  var loaderUtils = require("loader-utils");
9
- var assign = require("object-assign");
10
9
  var getLocalIdent = require("./getLocalIdent");
11
10
 
12
11
  var icssUtils = require('icss-utils');
@@ -55,9 +54,11 @@ var parserPlugin = postcss.plugin("css-loader-parser", function(options) {
55
54
  }
56
55
  values.nodes[0].nodes.shift();
57
56
  var mediaQuery = Tokenizer.stringifyValues(values);
58
- if(loaderUtils.isUrlRequest(url, options.root) && options.mode === "global") {
59
- url = loaderUtils.urlToRequest(url, options.root);
57
+
58
+ if(loaderUtils.isUrlRequest(url)) {
59
+ url = loaderUtils.urlToRequest(url);
60
60
  }
61
+
61
62
  importItems.push({
62
63
  url: url,
63
64
  mediaQuery: mediaQuery
@@ -83,11 +84,6 @@ var parserPlugin = postcss.plugin("css-loader-parser", function(options) {
83
84
  exports[exportName] = replaceImportsInString(exports[exportName]);
84
85
  });
85
86
 
86
- function isAlias(url) {
87
- // Handle alias starting by / and root disabled
88
- return url !== options.resolve(url)
89
- }
90
-
91
87
  function processNode(item) {
92
88
  switch (item.type) {
93
89
  case "value":
@@ -103,7 +99,7 @@ var parserPlugin = postcss.plugin("css-loader-parser", function(options) {
103
99
  }
104
100
  break;
105
101
  case "url":
106
- if (options.url && item.url.replace(/\s/g, '').length && !/^#/.test(item.url) && (isAlias(item.url) || loaderUtils.isUrlRequest(item.url, options.root))) {
102
+ if (options.url && item.url.replace(/\s/g, '').length && !/^#/.test(item.url) && loaderUtils.isUrlRequest(item.url)) {
107
103
  // Strip quotes, they will be re-added if the module needs them
108
104
  item.stringType = "";
109
105
  delete item.innerSpacingBefore;
@@ -139,17 +135,13 @@ var parserPlugin = postcss.plugin("css-loader-parser", function(options) {
139
135
 
140
136
  module.exports = function processCss(inputSource, inputMap, options, callback) {
141
137
  var query = options.query;
142
- var root = query.root && query.root.length > 0 ? query.root.replace(/\/$/, "") : query.root;
143
138
  var context = query.context;
144
139
  var localIdentName = query.localIdentName || "[hash:base64]";
145
140
  var localIdentRegExp = query.localIdentRegExp;
146
- var forceMinimize = query.minimize;
147
- var minimize = typeof forceMinimize !== "undefined" ? !!forceMinimize : options.minimize;
148
141
 
149
142
  var customGetLocalIdent = query.getLocalIdent || getLocalIdent;
150
143
 
151
144
  var parserOptions = {
152
- root: root,
153
145
  mode: options.mode,
154
146
  url: query.url !== false,
155
147
  import: query.import !== false,
@@ -164,11 +156,11 @@ module.exports = function processCss(inputSource, inputMap, options, callback) {
164
156
  if(parserOptions.url){
165
157
  url = url.trim();
166
158
 
167
- if(!url.replace(/\s/g, '').length || !loaderUtils.isUrlRequest(url, root)) {
159
+ if(!url.replace(/\s/g, '').length || !loaderUtils.isUrlRequest(url)) {
168
160
  return url;
169
161
  }
170
162
  if(global) {
171
- return loaderUtils.urlToRequest(url, root);
163
+ return loaderUtils.urlToRequest(url);
172
164
  }
173
165
  }
174
166
  return url;
@@ -187,16 +179,6 @@ module.exports = function processCss(inputSource, inputMap, options, callback) {
187
179
  parserPlugin(parserOptions)
188
180
  ]);
189
181
 
190
- if(minimize) {
191
- var cssnano = require("cssnano");
192
- var minimizeOptions = assign({}, query.minimize);
193
- ["zindex", "normalizeUrl", "discardUnused", "mergeIdents", "reduceIdents", "autoprefixer"].forEach(function(name) {
194
- if(typeof minimizeOptions[name] === "undefined")
195
- minimizeOptions[name] = false;
196
- });
197
- pipeline.use(cssnano(minimizeOptions));
198
- }
199
-
200
182
  pipeline.process(inputSource, {
201
183
  // we need a prefix to avoid path rewriting of PostCSS
202
184
  from: "/css-loader!" + options.from,
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "css-loader",
3
- "version": "0.28.9",
3
+ "version": "1.0.1",
4
4
  "author": "Tobias Koppers @sokra",
5
5
  "license": "MIT",
6
6
  "description": "css loader module for webpack",
7
7
  "engines": {
8
- "node": ">=0.12.0 || >= 4.3.0 < 5.0.0 || >=5.10"
8
+ "node": ">= 6.9.0 <7.0.0 || >= 8.9.0"
9
9
  },
10
10
  "files": [
11
11
  "lib",
@@ -15,12 +15,10 @@
15
15
  "dependencies": {
16
16
  "babel-code-frame": "^6.26.0",
17
17
  "css-selector-tokenizer": "^0.7.0",
18
- "cssnano": "^3.10.0",
19
18
  "icss-utils": "^2.1.0",
20
19
  "loader-utils": "^1.0.2",
21
- "lodash.camelcase": "^4.3.0",
22
- "object-assign": "^4.1.1",
23
- "postcss": "^5.0.6",
20
+ "lodash": "^4.17.11",
21
+ "postcss": "^6.0.23",
24
22
  "postcss-modules-extract-imports": "^1.2.0",
25
23
  "postcss-modules-local-by-default": "^1.2.0",
26
24
  "postcss-modules-scope": "^1.1.0",
@@ -36,6 +34,9 @@
36
34
  "should": "^11.1.2",
37
35
  "standard-version": "^4.0.0"
38
36
  },
37
+ "peerDependencies": {
38
+ "webpack": "^4.0.0"
39
+ },
39
40
  "scripts": {
40
41
  "lint": "eslint lib test",
41
42
  "test": "mocha",
@@ -1,36 +0,0 @@
1
- module.exports = function createResolver(alias) {
2
- if(typeof alias !== "object" || Array.isArray(alias)) {
3
- return function(url) {
4
- return url
5
- };
6
- }
7
-
8
- alias = Object.keys(alias).map(function(key) {
9
- var onlyModule = false;
10
- var obj = alias[key];
11
- if(/\$$/.test(key)) {
12
- onlyModule = true;
13
- key = key.substr(0, key.length - 1);
14
- }
15
- if(typeof obj === "string") {
16
- obj = {
17
- alias: obj
18
- };
19
- }
20
- obj = Object.assign({
21
- name: key,
22
- onlyModule: onlyModule
23
- }, obj);
24
- return obj;
25
- });
26
-
27
- return function(url) {
28
- alias.forEach(function(obj) {
29
- var name = obj.name;
30
- if(url === name || (!obj.onlyModule && url.startsWith(name + "/"))) {
31
- url = obj.alias + url.substr(name.length);
32
- }
33
- });
34
- return url;
35
- }
36
- }