Import Svg Files Inside Meteor
I'm working on a project using meteor + react as front-and-back end. For front-end UI, I am using element-react (https://eleme.github.io/element-react/#/en-US/quick-start) which is
Solution 1:
According to this post in Meteor's forum.
You can use something like Meteor methods and the Assets API to get most any data from your server though. Something like
/server/main.js
Meteor.methods({
'svg.get'(data) {
return Assets.getText(data.path)
}
})
and
/client/main.js
const getSVG = async (path) => {
returnawaitnewPromise((resolve, reject) => {
Meteor.call('svg.get', { path }, (err, res) => {
if (err) reject('Something went wrong')
resolve(res)
})
})
}
constSVG = awaitgetSVG('some/path/relative/to/private/file.svg')
Post a Comment for "Import Svg Files Inside Meteor"