0.3.5 • Published 1 year ago

@removify/icons v0.3.5

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Removify-icons

Welcome to Removify-Icons, our in-house icon library tailored for enhancing the user interfaces of our internal projects. This collection is an embodiment of our commitment to consistency, efficiency, and aesthetic appeal in all our digital products.

Key Features

  • Use icon with unplugin-icons and unplugin-vue-components.

  • Language server auto completion support with Volar.

  • Support with tailwind icon plugin.

Usage Guidelines

To see a working example, check removify-icons-example.

Installation

This library is built on top of iconify and unplugin-icons, also vite is recommended. To install, run the following command:

npm install -D unplugin-icons @removify/icons
# or
yarn add -D unplugin-icons @removify/icons
# or
pnpm add -D unplugin-icons @removify/icons

Usage

To use with vite:

// vite.config.ts
import { defineConfig } from 'vite';
import Icons from 'unplugin-icons/vite';
import { customCollections } from '@removify/icons';

export default defineConfig({
  ...otherConfig,
  plugins: [
    Icons({
      customCollections: {
        ...customCollections,
      },
    }),
  ],
});

Then you can import the icons in your project:

import ArrowLeft from '~icons/rmv-arrows/angle-left';

<ArrowLeft style="color: red; height: 20px; width: 20px;" />;

Auto Import

Reference to unplugin-icons.

Vue example:

// vite.config.ts
import { defineConfig } from 'vite';
import Icons from 'unplugin-icons/vite';
import { collectionKeys, customCollections } from '@removify/icons';
import IconsResolver from 'unplugin-icons/resolver';
import Components from 'unplugin-vue-components/vite';

export default defineConfig({
  plugins: [
    Icons({
      compiler: 'vue3',
      customCollections: {
        ...customCollections,
      },
    }),
    Components({
      resolvers: [
        IconsResolver({
          customCollections: [...collectionKeys],
        }),
      ],
    }),
  ],
});

To use that you can simply use:

<i-rmv-arrows-angle-left style="color: red; width: 3rem; height: 3rem">
</i-rmv-arrows-angle-left>

Volar

To make Volar know the components, you need to add the following code to vite.config.js:

import removifyIcons from 'removify-icons/vite';

export default defineConfig({
  plugins: [
    ...otherPlugins,
    removifyIcons(),
  ],
});

with this jsconfig.json or tsconfig.json option.

{
  "include": ["src/**/*.vue", "**/*.d.ts"]
}

In this way, you can have all the hints and auto-completion from Volar.

!CAUTION ⚠️ You should NOT remove the unplugin-vue-components plugin, our plugin is only for Volar to know the components. But to make the components work, you still need unplugin-vue-components.

Get the list of icons

To get the list of icons, you can import the data from:

import icons from '@removify/icons/json';

Tailwind CSS

We also provide a collection to work with tailwind icons plugin.

You have to make sure you have tailwind setup and the plugin installed:

pnpm add -D @egoist/tailwindcss-icons

To configure the plugin, you can add the following code to tailwind.config.ts:

import collections from '@removify/icons/iconify';
import { getIconCollections, iconsPlugin } from '@egoist/tailwindcss-icons';

export default {
  ...resetConfig,
  plugins: [
    iconsPlugin({
      collections: {
        ...collections,
        // Can add more if needed
        ...getIconCollections(['heroicons']),
      },
    }),
  ],
} satisfies Config;

Future work

!NOTE 🚧 A website to show all icons is planned, but not yet implemented, stay tuned! As unplugin-icons does not support dynamic import, would be little bit tricky to implement. The finally silly solution would to generate a file with all icons.

!NOTE 🚧 To export all components, rather than reply on unplugin-vue-components to auto import Such that use import { Alert } from 'removify-icons' to import all icons.

0.3.0

1 year ago

0.3.5

1 year ago

0.2.6

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.4

1 year ago

0.2.5

1 year ago

0.3.3

1 year ago

0.2.3

1 year ago

0.2.4

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago