Skip to content

Commit 5ef2739

Browse files
committed
fix for stuff like url('webfont.eot?#iefix')
1 parent 688fe54 commit 5ef2739

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

index.js

+7
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ module.exports = function(content) {
3131
var uriRegExp = /%CSSURL\[%(.*?)%\]CSSURL%/g;
3232
css = css.replace(uriRegExp, function(str) {
3333
var match = /^%CSSURL\[%(.*?)%\]CSSURL%$/.exec(str);
34+
var idx = match[1].indexOf("?");
35+
if(idx < 0) idx = match[1].indexOf("#");
36+
if(idx >= 0) {
37+
// in cases like url('webfont.eot?#iefix')
38+
var url = JSON.parse("\"" + match[1].substr(0, idx) + "\"");
39+
return "\"+require(" + JSON.stringify(urlToRequire(url)) + ")+\"" + match[1].substr(idx);
40+
}
3441
var url = JSON.parse("\"" + match[1] + "\"");
3542
return "\"+require(" + JSON.stringify(urlToRequire(url)) + ")+\"";
3643
});

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "css-loader",
3-
"version": "0.6.1",
3+
"version": "0.6.2",
44
"author": "Tobias Koppers @sokra",
55
"description": "css loader module for webpack",
66
"dependencies": {

0 commit comments

Comments
 (0)