Skip to content

Commit

Permalink
工具方法测试
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivomo committed Oct 30, 2020
1 parent 9628431 commit cfafae3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions build/test/testBuildUtil.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const {parseContent} = require('../utils');
console.log(parseContent(`<img src="../img/orochi.png" alt="" id="orochi" style="position: absolute;">`))
4 changes: 4 additions & 0 deletions build/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ exports.parseViewport = (dom) => {
return viewport && viewport.getAttribute('content');
};

exports.parseContent = (content) => {
return content.replace(/src="\.\.\/img\/([^"]+)"/, 'src={{site.cname}}src/img/$1')
}

exports.createBlog = (blog) => {
return `
---
Expand Down

0 comments on commit cfafae3

Please sign in to comment.