File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 3
3
Author Tobias Koppers @sokra
4
4
*/
5
5
var csso = require ( "csso" ) ;
6
- var uriRegExp = / % C S S U R L \[ % ( .* ) % \] C S S U R L % / g;
7
6
module . exports = function ( content ) {
8
7
var isRequireUrl = ! this || ! this . options || ! this . options . css ||
9
8
typeof this . options . css . requireUrl === "string" ;
@@ -32,8 +31,9 @@ module.exports = function(content) {
32
31
33
32
var css = JSON . stringify ( csso . translate ( tree ) ) ;
34
33
if ( isRequireUrl ) {
35
- css = css . replace ( uriRegExp , function ( match ) {
36
- match = uriRegExp . exec ( match ) ;
34
+ var uriRegExp = / % C S S U R L \[ % ( .* ?) % \] C S S U R L % / g;
35
+ css = css . replace ( uriRegExp , function ( str ) {
36
+ match = / ^ % C S S U R L \[ % ( .* ?) % \] C S S U R L % $ / . exec ( str ) ;
37
37
var url = JSON . parse ( "\"" + match [ 1 ] + "\"" ) ;
38
38
return "\"+require(" + JSON . stringify ( requireUrl + urlToRequire ( url ) ) + ")+\"" ;
39
39
} ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " css-loader" ,
3
- "version" : " 0.2.1 " ,
3
+ "version" : " 0.2.2 " ,
4
4
"author" : " Tobias Koppers @sokra" ,
5
5
"description" : " css loader module for webpack" ,
6
6
"dependencies" : {
Original file line number Diff line number Diff line change @@ -39,6 +39,6 @@ vows.describe("url").addBatch({
39
39
test ( ".class { background: green url( \"img.png\" ) xyz }" ,
40
40
[ "\".class { background: green url( \"+require(\"file/auto!./img.png\")+\" ) xyz }\"" ] ) ,
41
41
"background img 2" :
42
- test ( ".class { background: green url(~img/png ) xyz }" ,
43
- [ "\".class { background: green url(\"+require(\"file/auto!img/png\")+\" ) xyz }\"" ] )
42
+ test ( ".class { background: green url(~img/png ) url(aaa) xyz }" ,
43
+ [ "\".class { background: green url(\"+require(\"file/auto!img/png\")+\" ) url(\"+require(\"file/auto!./aaa\")+\") xyz }\"" ] )
44
44
} ) . export ( module ) ;
You can’t perform that action at this time.
0 commit comments