diff --git a/Gruntfile.js b/Gruntfile.js index f17526e33f59..43dc8abe82c0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -5,9 +5,37 @@ module.exports = function(grunt) { concat: { options: { process: function(src, filepath) { - // Fix path for image and font resources + var basepath = filepath.substring(7, filepath.lastIndexOf('/') + 1); + + console.log(filepath); + // Fix relative paths for css files if(filepath.indexOf('.css', filepath.length - 4) !== -1) { - return src.replace(/\.\.\/(images|fonts)\//g, '$1/'); + return src.replace(/(url\s*[\("']+)\s*([^'"\)]+)(['"\)]+;?)/gi, function(match, start, url, end, offset, string) { + if(url.indexOf('data:') === 0) { + // Skip data urls + return match; + + } else if(url.indexOf('/') === 0) { + // Skip absolute urls + return match; + + } else { + return start + basepath + url + end; + } + }); + + // Fix source maps locations + } else if(filepath.indexOf('.js', filepath.length - 4) !== -1) { + return src.replace(/(\/[*\/][#@]\s*sourceMappingURL=)([^\s]+)/gi, function(match, start, url, offset, string) { + if(url.indexOf('/') === 0) { + // Skip absolute urls + return match; + + } else { + return start + basepath + url; + } + }); + // Don't do anything for unknown file types } else { return src; diff --git a/app/views/invoices/pdf.blade.php b/app/views/invoices/pdf.blade.php index d711b1a964d2..c0e08a7214cd 100644 --- a/app/views/invoices/pdf.blade.php +++ b/app/views/invoices/pdf.blade.php @@ -21,13 +21,13 @@
-
-