grunt-packer
Advanced tools
Comparing version 0.1.12 to 0.1.13
@@ -8,2 +8,6 @@ var path = require('path'), | ||
var matchResult = code.match(/url\((?!("|')?data:)[^#\)]+?\)/ig); | ||
root = path.normalize(root + path.sep); | ||
cssDir = path.normalize(cssDir + path.sep); | ||
if (matchResult) { | ||
@@ -17,4 +21,9 @@ matchResult.forEach(function(match){ | ||
url = parts[1]; | ||
else | ||
url = '/' + path.relative(root, path.resolve(cssDir, parts[1])); | ||
else { | ||
var newPath = path.resolve(cssDir, parts[1]); | ||
url = path.relative(root, newPath); | ||
if (newPath.substr(0, root.length) == root && url.charAt(0) !== '/') { | ||
url = '/' + url; | ||
} | ||
} | ||
code = code.replace(match, "url('" + url.replace(/\\/g, '/') + "')"); | ||
@@ -21,0 +30,0 @@ } |
{ | ||
"name": "grunt-packer", | ||
"description": "Grunt plugin to automagically concat JS and CSS files found in HTML", | ||
"version": "0.1.12", | ||
"version": "0.1.13", | ||
"author": "Oleg Elifantiev <oleg@elifantiev.ru>", | ||
@@ -6,0 +6,0 @@ "contributors": [], |
35296
54
743