Skip to content

acrool/acrool-icon-symbols

Repository files navigation

Acrool Icon Symbols

Merge svg into svg symbols, and unpack svg symbols into individual svg

NPM npm npm

npm downloads npm

Features

  • Merge svg into svg symbols
  • unpack svg symbols into individual svg
  • Parse SVG content

Install

yarn add -D acrool-icon-symbols

Use

import {decodeSvgPaths, decodeSymbols} from 'acrool-icon-symbols';

const fileContent = await fs.readFileSync(filePath);
const svg = decodeSvgPaths(fileContent.toString());

const symbols = decodeSymbols(fileContent.toString());

const newId = await this.iconSymbolService.create({
    code: file.filename.replace(/[ -]/g,'_').replace(/.svg$/,''),
    viewBox: svg.viewBox,
    content: svg.paths.join(''),
    iconDepotId,
    creatorId: currentMember.id,
});

Document

License

MIT © Acrool & Imagine