shrhdk / text-to-svg

Convert text to SVG path without native dependence.
Other
964 stars 131 forks source link

Usage with Vuejs #54

Closed katOstrynska closed 4 years ago

katOstrynska commented 4 years ago

I would like to use this plugin in my Vuejs project, but I have problems with setting it right. When in my component I use basic example:

const TextToSVG = require('text-to-svg'); const textToSVG = TextToSVG.loadSync(); const svg = textToSVG.getSVG('hello'); console.log(svg);

I got TypeError: fs.readFileSync is not a function error.

selmalee commented 4 years ago

fs是nodejs的内建模块。建议在nodejs服务中提供一个接口,前端再去请求。

fs is a built-in module of nodejs. It is recommended to provide an interface in the nodejs service, and then request it from the front end.