How to use @mdi/svg - 3 common examples

To help you get started, we’ve selected a few @mdi/svg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github levrik / mdi-react / scripts / generate.js View on Github external
const content = fs.readFileSync(path.join(svgFilesPath, svgFile));
    const svgPathMatches = svgPathRegex.exec(content);
    const svgPath = svgPathMatches && svgPathMatches[1];
    // skip on empty svgPath
    if (!svgPath) throw new Error('Empty SVG path');

    const icon = {
      name: name,
      aliases: [],
      fileName: name + '.js',
      defFileName: name + '.d.ts',
      svgPath
    };

    const iconMeta = meta.find(entry => entry.name === origName);
    if (iconMeta) {
      icon.aliases = iconMeta.aliases;
    }

    icons.push(icon);
  }

  const aliases = [];
  const removeAliases = [];
  for (const icon of icons) {
    for (const alias of icon.aliases) {
      const normalizedAlias = normalizeName(alias);

      // if the alias starts with a number, ignore it since JavaScript
      // doesn't support variable names starting with a number
      if (startsWithNumberRegex.test(normalizedAlias)) {
github darosh / material-icons-bundle / build / lib / loadCommunity.js View on Github external
require('../../meta/_community.json').icons.forEach(d => {
      const f = meta.find(m => d.name === m.name) || {}

      const m = {
        author: d.user.name,
        aliases: d.aliases,
        tags: f.tags
      }

      data.push({
        source: 'Community',
        author: m.author,
        name: d.name.replace(/[-_]/g, ' '),
        aliases: m.aliases && m.aliases.length ? m.aliases : undefined,
        tags: m.tags && m.tags.length ? m.tags : undefined,
        version: f.version || '?',
        data: d.data
      })
github arnellebalane / mdi-cli / index.js View on Github external
source(answers, input) {
        return input
            ? Promise.resolve(fuse.search(input))
            : Promise.resolve(icons.map(icon => icon.name));
    },
    searchable: true

@mdi/svg

Material Design Icons SVG

Apache-2.0
Latest version published 11 months ago

Package Health Score

61 / 100
Full package analysis