svg-path-loader

Webpack loader to get the first path in a SVG file

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
svg-path-loader
300.0.45 years ago6 years agoMinified + gzip package size for svg-path-loader in KB

Readme

svg-path-loader
Codeship Status for svg-path-loader NPM version for svg-path-loader
Webpack loader to get the first path in an SVG file.

Install

npm i svg-path-loader

Usage

// Without a webpack loader config
import path1 from 'svg-path-loader!./image1.svg';

// With a webpack loader config
import path2 from './image2.svg';

// Construct your SVG
export default function Icon() {
  return (
    <svg height={16} width={16} viewBox="0 0 16 16">
      <path d={path1} />
    </svg>
  );
}

Webpack loader config

{
  test: /\.svg$/,
  loader: 'svg-path-loader',
}