grunt-inline
Advanced tools
Comparing version 0.3.4 to 0.3.5
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -9,3 +9,3 @@ { | ||
"description": "Inlines img, script and link tags into the same file.", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"keywords": [ | ||
@@ -12,0 +12,0 @@ "gruntplugin", |
@@ -16,3 +16,3 @@ /* | ||
var CleanCSS = require('clean-css'); | ||
grunt.registerMultiTask('inline', "Replaces <link>, <script> and <img> tags to their inline contents", function() { | ||
@@ -29,7 +29,7 @@ | ||
this.files.forEach(function(filePair){ | ||
isExpandedPair = filePair.orig.expand || false; | ||
filePair.src.forEach(function(filepath){ | ||
var fileType = path.extname(filepath).replace(/^\./, ''); | ||
@@ -52,3 +52,3 @@ var fileContent = grunt.file.read(filepath); | ||
} | ||
grunt.file.write(destFilepath, fileContent); | ||
@@ -75,3 +75,3 @@ grunt.log.ok() | ||
} | ||
} | ||
} | ||
@@ -119,6 +119,10 @@ function unixifyPath(filepath) { | ||
if(!_src.match(/^http\:\/\//)){ | ||
_ret =arguments[1] + _more + arguments[2] + arguments[3]; | ||
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 ); | ||
} | ||
return _ret; | ||
return _ret; | ||
} | ||
@@ -144,5 +148,5 @@ ret = ret.replace(/(<script.+?src=["'])([^"']+?)(["'].*?><\/script>)/g,_addMore); | ||
} | ||
} | ||
} | ||
grunt.log.debug('ret = : ' + ret +'\n'); | ||
return ret; | ||
@@ -152,6 +156,6 @@ | ||
var ret = matchedWord; | ||
if(!isRemotePath(src) && src.indexOf(options.tag)!=-1){ | ||
var inlineFilePath = path.resolve( path.dirname(filepath), src ).replace(/\?.*$/, ''); // 将参数去掉 | ||
var inlineFilePath = path.resolve( path.dirname(filepath), src ).replace(/\?.*$/, ''); // 将参数去掉 | ||
@@ -166,10 +170,10 @@ if( grunt.file.exists(inlineFilePath) ){ | ||
grunt.log.debug('ret = : ' + ret +'\n'); | ||
return ret; | ||
return ret; | ||
}).replace(/<img.+?src=["']([^"':]+?)["'].*?\/?\s*?>/g, function(matchedWord, src){ | ||
var ret = matchedWord; | ||
if(!grunt.file.isPathAbsolute(src) && src.indexOf(options.tag)!=-1){ | ||
var inlineFilePath = path.resolve( path.dirname(filepath), src ).replace(/\?.*$/, ''); // 将参数去掉 | ||
var inlineFilePath = path.resolve( path.dirname(filepath), src ).replace(/\?.*$/, ''); // 将参数去掉 | ||
@@ -181,6 +185,6 @@ if( grunt.file.exists(inlineFilePath) ){ | ||
} | ||
} | ||
} | ||
grunt.log.debug('ret = : ' + ret +'\n'); | ||
return ret; | ||
return ret; | ||
}); | ||
@@ -187,0 +191,0 @@ |
@@ -0,0 +0,0 @@ var grunt = require('grunt'); |
@@ -0,0 +0,0 @@ var grunt = require('grunt'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
80682
355
1