Navigation Menu

Skip to content

Commit

Permalink
better regex url match
Browse files Browse the repository at this point in the history
  • Loading branch information
mklabs committed Oct 16, 2011
1 parent 17405d8 commit ca1f5c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/datauri.js
Expand Up @@ -22,7 +22,7 @@ exports.cssEach = function cssEach(it) {
//
// #book_go { background: url(../images/embed/book_go.png); }
//
it.content = it.content.replace(/(.+)\{(.+url\(.+\).+)\}/gm, function(w, selector, block) {
it.content = it.content.replace(/(.+)\{(.+url\([^)]+\).+)\}/gm, function(w, selector, block) {

var ieholder = [
'.ie6 :selector, .ie7 :selector {'.replace(/:selector/g, selector.trim()),
Expand All @@ -47,7 +47,7 @@ exports.cssDatauri = function cssDatauri(it) {
mhtml = ['Content-Type: multipart/related; boudary="' + boundary + '"\n\n'];

// deal with datauris, replace inline url() by their base64 equivalent
it.content = it.content.replace(/url\((.+)\)/g, function(w, url) {
it.content = it.content.replace(/url\(([^)]+)\)/g, function(w, url) {
var cssfold = file.split('/').slice(0, -1).join('/'),
imgpath = path.resolve(cssfold, url),
base64 = helpers.toBase64(imgpath),
Expand Down

0 comments on commit ca1f5c9

Please sign in to comment.