Icon Pipeline is a utility for optimizing SVG icons and generating SVG sprites, along with individual optimized SVG files and a manifest of available icons. It aims to provide a 'no-nonsense' automated pipeline for icon management in web projects. As of version 0.2.0, the package is in early development, suggesting an irregular release cadence and that its API might not yet be stable. Its key differentiator lies in its integrated approach, handling both SVG optimization and sprite generation (for both HTML `<use>` and JavaScript injection) within a single tool, outputting multiple formats ready for different consumption patterns, which simplifies the icon build process compared to using separate tools for each step. It is designed to be included as a development dependency and run as part of a project's build process.
npm install icon-pipelineVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to configure and run the `icon-pipeline` using CommonJS `require`. It sets source and output directories, then executes the pipeline asynchronously to optimize SVGs and generate sprite files, logging the resulting metadata.
Pin to specific patch versions (`~0.2.0` instead of `^0.2.0`) and review the GitHub repository for changes before upgrading. Exercise caution when deploying to production.
Always use `.then()` to process the results of `iconPipeline` or `await` it within an `async` function to ensure icon data is available when accessed.
If `includeSpriteInSrc` is true, ensure your `.gitignore` file explicitly excludes `sprite.js` and `sprite.svg` from the source directory, or set `includeSpriteInSrc: false` and manage these files in your `outputDir`.
Access `iconData` only within the `.then()` callback of the `iconPipeline` Promise, or by using `await iconPipeline(...)` within an `async` function.
For the main `iconPipeline` function, use `const iconPipeline = require('icon-pipeline')`. If your project strictly uses ESM, you might need to use a CommonJS wrapper or wait for native ESM support in future versions of the package.No dependency data recorded yet.