0.5.1 • Published 1 year ago

@atrium-ui/vite-svg-sprite v0.5.1

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

vite-svg-sprite

Compile svgs in a directory to a spritesheet and make it available as inlined blob url. Includes a CustomElement that makes it easy to use any icon.

Not just Icons. Use src for any SVG content.

<svg-icon icon="speaker" />

Install

npm install @atrium-ui/vite-svg-sprite

Vite configuration

import svgSprite from "@atrium-ui/vite-svg-sprite/plugin/vite";

export default {
  plugins: [
    svgSprite({ dir: "src/assets/icons/*.svg" }),
  ],
};

Next / Webpack configuration

/** @type {import('next').NextConfig} */
module.exports = {
  webpack(config, options) {
    config.module.rules.push({
      use: [
        {
          loader: "@atrium-ui/vite-svg-sprite/loader",
          options: {
            dir: "./assets/icons/*.svg",
          },
        },
      ],
    });

    return config;
  },
};

Component Usage

Place your SVG files in a directory of choice, by default /assets/icons/*.svg.

// import component
import "@atrium-ui/vite-svg-sprite/component";

// ...
// use in html
<body>
  <svg-icon icon="speaker" />
</body>
0.4.8

1 year ago

0.3.6-dev

1 year ago

0.3.0

1 year ago

0.3.5

1 year ago

0.5.0

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.4

1 year ago

0.5.1

1 year ago

0.3.3

1 year ago

0.4.5

1 year ago

0.4.4

1 year ago

0.4.7

1 year ago

0.4.6

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

0.2.24

1 year ago

0.2.23

1 year ago

0.2.22

1 year ago

0.2.21

1 year ago

0.2.20

1 year ago

0.2.19

1 year ago

0.2.18

1 year ago

0.2.17

1 year ago

0.2.16

1 year ago

0.2.15

1 year ago

0.2.14

1 year ago

0.2.13

1 year ago

0.2.12

1 year ago

0.2.11

1 year ago

0.2.10

1 year ago

0.2.9

1 year ago

0.2.8

1 year ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago