css-loader
Advanced tools
Comparing version 0.6.12 to 0.7.0
24
index.js
@@ -15,3 +15,3 @@ /* | ||
if(tree && this && this.minimize) { | ||
tree = csso.compress(tree); | ||
tree = csso.compress(tree, query.disableStructuralMinification); | ||
tree = csso.cleanInfo(tree); | ||
@@ -42,15 +42,15 @@ } | ||
css = css.replace(uriRegExp, function(str) { | ||
var match = /^%CSSURL\[%(.*?)%\]CSSURL%$/.exec(str); | ||
if(!loaderUtils.isUrlRequest(match[1], root)) return match[1]; | ||
var idx = match[1].indexOf("?"); | ||
if(idx < 0) idx = match[1].indexOf("#"); | ||
var match = /^%CSSURL\[%(["']?(.*?)["']?)%\]CSSURL%$/.exec(JSON.parse('"' + str + '"')); | ||
var url = loaderUtils.parseString(match[2]); | ||
if(!loaderUtils.isUrlRequest(match[2], root)) return JSON.stringify(match[1]).replace(/^"|"$/g, ""); | ||
var idx = url.indexOf("?"); | ||
if(idx < 0) idx = url.indexOf("#"); | ||
if(idx > 0) { | ||
// in cases like url('webfont.eot?#iefix') | ||
var url = JSON.parse("\"" + match[1].substr(0, idx) + "\""); | ||
return "\"+require(" + JSON.stringify(loaderUtils.urlToRequest(url, root)) + ")+\"" + match[1].substr(idx); | ||
var request = url.substr(0, idx); | ||
return "\"+require(" + JSON.stringify(loaderUtils.urlToRequest(request, root)) + ")+\"" + url.substr(idx); | ||
} else if(idx === 0) { | ||
// only hash | ||
return match[1]; | ||
return JSON.stringify(match[1]).replace(/^"|"$/g, ""); | ||
} | ||
var url = JSON.parse("\"" + match[1] + "\""); | ||
return "\"+require(" + JSON.stringify(loaderUtils.urlToRequest(url, root)) + ")+\""; | ||
@@ -86,5 +86,5 @@ }); | ||
if(item[0] === "string") { | ||
imp.url = JSON.parse(item[1]); | ||
imp.url = loaderUtils.parseString(item[1]); | ||
} else if(item[0] === "uri") { | ||
imp.url = item[1][0] === "string" ? JSON.parse(item[1][1]) : item[1][1]; | ||
imp.url = item[1][0] === "string" ? loaderUtils.parseString(item[1][1]) : item[1][1]; | ||
} else if(item[0] === "ident" && item[1] !== "url") { | ||
@@ -134,3 +134,3 @@ imp.media.push(csso.translate(item)); | ||
case "string": | ||
item[1] = "%CSSURL[%" + item[1].substring(1, item[1].length-1) + "%]CSSURL%"; | ||
item[1] = "%CSSURL[%" + item[1] + "%]CSSURL%"; | ||
return; | ||
@@ -137,0 +137,0 @@ } |
{ | ||
"name": "css-loader", | ||
"version": "0.6.12", | ||
"version": "0.7.0", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "css loader module for webpack", |
@@ -16,4 +16,2 @@ # css loader for webpack | ||
css code will be minimized if specified by the module system. | ||
`@import` and `url(...)` are interpreted like `require()` and will be resolved by the css-loader. | ||
@@ -35,5 +33,5 @@ Good loaders for requiring your assets are the [file-loader](https://github.com/webpack/file-loader) | ||
loaders: [ | ||
{ test: /\.css/, loader: "style-loader!css-loader" }, | ||
{ test: /\.png/, loader: "url-loader?limit=100000&mimetype=image/png" }, | ||
{ test: /\.jpg/, loader: "file-loader" } | ||
{ test: /\.css$/, loader: "style-loader!css-loader" }, | ||
{ test: /\.png$/, loader: "url-loader?limit=100000&mimetype=image/png" }, | ||
{ test: /\.jpg$/, loader: "file-loader" } | ||
] | ||
@@ -56,3 +54,3 @@ } | ||
loaders: [ | ||
{ test: /\.css/, loader: "style-loader!css-loader?root=." }, | ||
{ test: /\.css$/, loader: "style-loader!css-loader?root=." }, | ||
... | ||
@@ -66,4 +64,10 @@ ] | ||
### Minification | ||
By default the css-loader minimizes the css if specified by the module system. | ||
In some cases the structural minification is destructive to the css, so you can disable it with the `disableStructuralMinification` query parameter. `require("css-loader?disableStructuralMinification!./file.css")` | ||
## License | ||
MIT (http://www.opensource.org/licenses/mit-license.php) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7078
70