grunt-inline
Advanced tools
Comparing version 0.3.5 to 0.3.6
@@ -9,3 +9,3 @@ { | ||
"description": "Inlines img, script and link tags into the same file.", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"keywords": [ | ||
@@ -12,0 +12,0 @@ "gruntplugin", |
@@ -110,18 +110,33 @@ /* | ||
// @otod need to be checked, add bye herbert | ||
var _more = src.match(/^(..\/)+/ig); | ||
if(_more = _more && _more[0]){ | ||
var _addMore = function(){ | ||
var _ret = arguments[0],_src = arguments[2]; | ||
if(options.relativeHTMLPath || src.match(/^(..\/)+/ig)){ | ||
ret = ret.replace(/(<script.+?src=["'])([^"']+?)(["'].*?><\/script>)/g, function(){ | ||
var _src = arguments[2]; | ||
if(!_src.match(/^http\:\/\//)){ | ||
if(options.relativeHTMLPath){ // 转换相对路径--add by vienwu | ||
_ret =arguments[1] + path.join(src,'../',arguments[2]).replace(/\\/g,'/') + arguments[3]; | ||
}else{ | ||
_ret =arguments[1] + _more + arguments[2] + arguments[3]; | ||
} | ||
grunt.log.writeln('inline >含有相对目录进行替换操作,替换之后的路径:' + _ret ); | ||
// 转换相对路径--add by vienwu | ||
var _path = path.join(src,'../',arguments[2]).replace(/\\/g,'/'); | ||
grunt.log.write('\n replace inline path '+ arguments[2] + ' >>> ' + _path); | ||
return arguments[1] + _path + arguments[3]; | ||
}else{ | ||
return arguments[1] + arguments[2] + arguments[3]; | ||
} | ||
return _ret; | ||
} | ||
ret = ret.replace(/(<script.+?src=["'])([^"']+?)(["'].*?><\/script>)/g,_addMore); | ||
}); | ||
} | ||
// var _more = src.match(/^(..\/)+/ig); | ||
// if(_more = _more && _more[0]){ | ||
// var _addMore = function(){ | ||
// var _ret = arguments[0],_src = arguments[2]; | ||
// if(!_src.match(/^http\:\/\//)){ | ||
// if(options.relativeHTMLPath){ // 转换相对路径--add by vienwu | ||
// _ret =arguments[1] + path.join(src,'../',arguments[2]).replace(/\\/g,'/') + arguments[3]; | ||
// }else{ | ||
// _ret =arguments[1] + _more + arguments[2] + arguments[3]; | ||
// } | ||
// grunt.log.writeln('inline >含有相对目录进行替换操作,替换之后的路径:' + _ret ); | ||
// } | ||
// grunt.log.writeln(_ret,options.relativeHTMLPath,123); | ||
// return _ret; | ||
// } | ||
// ret = ret.replace(/(<script.+?src=["'])([^"']+?)(["'].*?><\/script>)/g,_addMore); | ||
// } | ||
}else{ | ||
@@ -128,0 +143,0 @@ grunt.log.error("Couldn't find " + inlineFilePath + '!'); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
81389
369
0