0.5.1 • Published 2 years ago

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

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years 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

2 years ago

0.3.6-dev

3 years ago

0.3.0

3 years ago

0.3.5

3 years ago

0.5.0

2 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.4

3 years ago

0.5.1

2 years ago

0.3.3

3 years ago

0.4.5

3 years ago

0.4.4

3 years ago

0.4.7

2 years ago

0.4.6

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.2.24

3 years ago

0.2.23

3 years ago

0.2.22

3 years ago

0.2.21

3 years ago

0.2.20

3 years ago

0.2.19

3 years ago

0.2.18

3 years ago

0.2.17

3 years ago

0.2.16

3 years ago

0.2.15

3 years ago

0.2.14

3 years ago

0.2.13

3 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.10

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago