@icon-magic/config-reader
TypeScript icon, indicating that this package has built-in type declarations

2.8.0-beta.0 • Public • Published

@icon-magic/config-reader

This module is responsible for finding the closest config file(iconrc.json/iconrc.js/icon) to an icon and resolving all the paths in the config file so it's relative to the icon bundle. It helps in

  • Locating config files within directories
  • Provides utils to read, validate and write icon config files
  • Defining and managing the data for each icon
  • Managing the config data for a set of icons in memory via a hash

Interface

getIconConfigSet(inputPaths: string[]): IconConfigHash

This is the primary method that the bundle exposes and is responsible for taking a set of input paths and constructing a map of the path to the icon and it's corresponding config JSON that should, entirely represent the characteristics of the icon. It validates the structure of all the configs as well.

An example input iconrc.json looks like this. Refer to @icon-magic/config-reader/schemas/config-schema for a detailed description of the various fields

{
  "iconPath": "*",
  "variants": [
    {
      "path": "./filled.svg"
    },
    {
      "name": "someOtherName",
      "path": "./outline.svg"
    }
  ],
  "sizes": [24],
  "resolutions": [1],
  "build": {
    "outputPath": "./out"
  },
  "generate": {
    "outputPath": "./out",
    "types": [
      {
        "name": "svg",
        "plugins": []
      },
      {
        "name": "raster",
        "plugins": []
      }
    ]
  }
}

For more details on the interfaces, refer to @icon-magic/icon-models

Dependencies (6)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @icon-magic/config-reader

    Weekly Downloads

    1

    Version

    2.8.0-beta.0

    License

    BSD-2-Clause

    Unpacked Size

    104 kB

    Total Files

    43

    Last publish

    Collaborators

    • thegilby
    • camario25
    • epicmiller
    • rchitloor
    • omayeli