Skip to content

Commit af3ca28

Browse files
authored
Modify svg helper so it references path correctly in preview and build (#17)
1 parent 6a4186d commit af3ca28

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.DS_Store
12
/build/
23
/node_modules/
34
/public/

src/helpers/svg.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
'use strict'
22

3-
const fs = require('fs')
43
const path = require('path')
54

6-
module.exports = (iconName) => {
7-
const pathName = path.join(__dirname, '/src/img/', iconName + '.svg')
8-
const content = fs.readFileSync(pathName, 'utf8')
9-
return content
5+
module.exports = (iconName, { data }) => {
6+
const uiRootPath = data.root.uiRootPath
7+
const svgFilePath = path.join(uiRootPath, 'img', iconName + '.svg')
8+
return '<img src="' + svgFilePath + '" alt="' + iconName + '" />'
109
}

0 commit comments

Comments
 (0)