@realfavicongenerator/generate-favicon
Version:
Generate a favicon
19 lines (18 loc) • 797 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringToSvg = exports.rawDataToDownloadableContent = void 0;
// Returns a string that can be assigned to a.href as is.
const rawDataToDownloadableContent = (content, mimeType) => ('data:' + mimeType + ';charset=utf-8,' + encodeURIComponent(content));
exports.rawDataToDownloadableContent = rawDataToDownloadableContent;
const stringToSvg = (svg, imageAdapter) => {
const s = imageAdapter.createSvg();
s.svg(svg);
const subSvg = s.find('svg')[0];
if (subSvg) {
const viewBox = subSvg.viewbox();
s.width(subSvg.width() ? subSvg.width() : viewBox.width);
s.height(subSvg.height() ? subSvg.height() : viewBox.height);
}
return s;
};
exports.stringToSvg = stringToSvg;