Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-inline

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-inline - npm Package Compare versions

Comparing version 0.3.5 to 0.3.6

2

package.json

@@ -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 + '!');

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc