Answer the question
In order to leave comments, you need to log in
How to write SVG image content to variable, es6, gulp?
Tell me how to write the svg code from a file to a variable? To get something like:
const mysvg = '<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">.........</svg>'
Answer the question
In order to leave comments, you need to log in
fs.readfile
Google the fs module for node. This is from the standard libs.
If you need to get an existing node in this form, then you can use, for example, the outerhtml method
// HTML:
// <div id="d"><p>Content</p><p>Further Elaborated</p></div>
d = document.getElementById("d");
console.log(d.outerHTML);
// строка '<div id="d"><p>Content</p><p>Further Elaborated</p></div>'
// выведена в окно консоли
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question