From ff948006f45ba29647cee3c4b6549b8d04d3df69 Mon Sep 17 00:00:00 2001 From: Skinner927 Date: Tue, 25 Mar 2014 15:15:35 -0400 Subject: [PATCH 1/2] Check link and img tags for Base64 encoded src If a or tag in HTML already has its src/href base64 encoded, it should be skipped. --- tasks/inline.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/inline.js b/tasks/inline.js index 07001bf..d75f00b 100644 --- a/tasks/inline.js +++ b/tasks/inline.js @@ -99,7 +99,7 @@ module.exports = function(grunt) { }).replace(//g, function(matchedWord, src){ var ret = matchedWord; - if(!isRemotePath(src) && src.indexOf(options.tag)!=-1){ + if(!isBase64Path(src) && isBase64Path!isRemotePath(src) && src.indexOf(options.tag)!=-1){ var inlineFilePath = path.resolve( path.dirname(filepath), src ).replace(/\?.*$/, ''); // 将参数去掉 @@ -116,7 +116,7 @@ module.exports = function(grunt) { }).replace(//g, function(matchedWord, src){ var ret = matchedWord; - if(!grunt.file.isPathAbsolute(src) && src.indexOf(options.tag)!=-1){ + if(!isBase64Path(src) && !grunt.file.isPathAbsolute(src) && src.indexOf(options.tag)!=-1){ var inlineFilePath = path.resolve( path.dirname(filepath), src ).replace(/\?.*$/, ''); // 将参数去掉 From 24e9ee734695abead9119c0d845d59f46b7a4157 Mon Sep 17 00:00:00 2001 From: Skinner927 Date: Tue, 25 Mar 2014 15:17:51 -0400 Subject: [PATCH 2/2] Fix typo from github editor --- tasks/inline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/inline.js b/tasks/inline.js index d75f00b..da8adcf 100644 --- a/tasks/inline.js +++ b/tasks/inline.js @@ -99,7 +99,7 @@ module.exports = function(grunt) { }).replace(//g, function(matchedWord, src){ var ret = matchedWord; - if(!isBase64Path(src) && isBase64Path!isRemotePath(src) && src.indexOf(options.tag)!=-1){ + if(!isBase64Path(src) && !isRemotePath(src) && src.indexOf(options.tag)!=-1){ var inlineFilePath = path.resolve( path.dirname(filepath), src ).replace(/\?.*$/, ''); // 将参数去掉