How to use the @carbon/icon-helpers.toString function in @carbon/icon-helpers

To help you get started, we’ve selected a few @carbon/icon-helpers 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 carbon-design-system / carbon / packages / icons-angular / src / build.js View on Github external
async function generateComponents() {
  // loop through the icons meta array
  for (const icon of icons) {
    const className = icon.moduleName;
    const selectorName = param(icon.moduleName);
    const rawSvg = toString(icon.descriptor);
    const outputPath = icon.outputOptions.file
      .replace('es', 'ts')
      .replace('.js', '.ts');
    // try to write out the component
    try {
      await fs.ensureDir(dirname(outputPath));
      await fs.writeFile(
        outputPath,
        componentTemplate(
          selectorName,
          className,
          rawSvg,
          icon.descriptor.attrs
        )
      );
    } catch (err) {

@carbon/icon-helpers

Helpers used alongside icons for digital and software products using the Carbon Design System

Apache-2.0
Latest version published 16 days ago

Package Health Score

98 / 100
Full package analysis