grunt-combohtml
Advanced tools
Comparing version 0.1.4 to 0.1.5
{ | ||
"name": "grunt-combohtml", | ||
"description": "combine build html with ssi.", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"homepage": "", | ||
@@ -40,8 +40,7 @@ "author": { | ||
"readmeFilename": "README.md", | ||
"_id": "grunt-combohtml@0.1.3", | ||
"_id": "grunt-combohtml@0.1.4", | ||
"_from": "grunt-combohtml@", | ||
"dist": { | ||
"shasum": "876e2218d24b85ff2c43365a7f42569528a40fed" | ||
}, | ||
"_resolved": "https://registry.npmjs.org/grunt-flexcombo/-/grunt-flexcombo-0.1.8.tgz" | ||
} | ||
} |
@@ -31,3 +31,7 @@ # grunt-combohtml | ||
options:{ | ||
encoding:'utf8' | ||
encoding:'utf8',//输出文件编码 | ||
replacement:{ // 抓取js/css文件时路径替换规则,留空为不替换 | ||
from:/src\//, | ||
to:'build/' | ||
} | ||
}, | ||
@@ -39,5 +43,5 @@ main:{ | ||
cwd:'src', | ||
src: ['**/*.html'], | ||
src: ['**/*.htm'], | ||
dest: 'build/', | ||
ext: '.html' | ||
ext: '.htm' | ||
} | ||
@@ -44,0 +48,0 @@ ] |
@@ -51,4 +51,4 @@ /* | ||
var js_content = concat(result.js,dest_js,v.orig.cwd,p); | ||
var css_content = concat(result.css,dest_css,v.orig.cwd,p); | ||
var js_content = concat(result.js,dest_js,v.orig.cwd,p,options.replacement); | ||
var css_content = concat(result.css,dest_css,v.orig.cwd,p,options.replacement); | ||
@@ -55,0 +55,0 @@ chunk = chunk.replace('@@script',path.basename(v.dest,path.extname(v.dest)) + '.js'); |
@@ -13,6 +13,8 @@ // 'use strict'; | ||
// 'src/~page/index.html' | ||
function concat(a,o,dest,p){ | ||
// {from:/src/,to:'build'} | ||
function concat(a,o,dest,p,replacement){ | ||
var content = ''; | ||
var a = a.reverse(); | ||
// console.log(a); | ||
// var a = a.reverse(); | ||
var rel = path.dirname(path.relative(dest,p)); | ||
@@ -26,2 +28,5 @@ fs.writeFileSync(o,'',{ | ||
var ap = path.resolve(pwd,dest,rel,v); | ||
if(replacement){ | ||
ap = ap.replace(replacement.from,replacement.to); | ||
} | ||
if(!fs.existsSync(ap)){ | ||
@@ -28,0 +33,0 @@ return; |
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
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
40082
1086
63