@nycopportunity/pttrn-plugin-feather

A plugin script for the @NYCOpportunity Pattern CLI that will compile a feather icon sprite from the source.

Usage no npm install needed!

<script type="module">
  import nycopportunityPttrnPluginFeather from 'https://cdn.skypack.dev/@nycopportunity/pttrn-plugin-feather';
</script>

README

Patterns CLI Feather Plugin

This command plugin will compile a SVG icon sprite from the Feather Icon set.

Usage

Install as a development dependency in a project that uses the Patterns CLI.

$ npm install @nycopportunity/pttrn-plugin-feather -D

Add a proxy command script in the ./bin/ directory:

$ touch bin/feather.js
$ echo "module.exports = require('@nycopportunity/pttrn-plugin-feather');"

This will make the command available to the CLI. Compile the sprite by running:

$ npx pttrn feather
$ ✨ Feather sprite written to ./dist/svg/feather.svg

An optional config file can be added with the following options:

Option | Description ---------|- src | The source directory for Feather icons. dist | The distribution path and file name for the compiled sprite. ext | The extension name for the icons files (this shouldn't change). prefix | The prefix to add to the <svg> element ID attribute.

Config Sample

const path = require('path');

module.exports = {
  'src': path.join(process.env.PWD, 'node_modules/feather-icons/dist/icons'),
  'dist': path.join(process.env.PWD, 'dist', 'svg', 'feather.svg'),
  'ext': '.svg',
  'prefix': 'feather-'
};