Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

esbuild-plugin-svg

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugin-svg

Svg files import plugin for esbuild.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.9K
decreased by-10.24%
Maintainers
1
Weekly downloads
 
Created
Source

esbuild-plugin-svg

Svg files import plugin for esbuild.


Install

npm install esbuild-plugin-svg -D

String

import iconLogo from './logo.svg';

render() {
    return `
        ${iconLogo}
    `;
}

Custom element

import iconLogo from './logo.svg';

render() {
    return `
        <icon-logo></icon-logo>
    `;
} // namespace + filename

Use

esbuild.config.json

import esbuild from 'esbuild';
import svg from 'esbuild-plugin-svg';

esbuild
    .build({
        entryPoints: ['index.js'],
        bundle: true,
        outfile: 'main.js',
        plugins: [svg()]
    })
    .catch(() => process.exit(1));

package.json

{
    "type": "module",
    "scripts": {
        "start": "node esbuild.config.js"
    }
}

Configure

esbuild.config.json

svg({
    customElement: false,
    namespace: 'icon', // namespace custom elements
    minify: false, // with svgo
    minifyOptions: {} // svgo options
});

Includes

SVGO   →   Optimizes svg files.


Check

esbuild-serve   →   Serve with live reload for esbuild.

esbuild-plugin-pipe   →   Pipe esbuild plugins output.

esbuild-plugin-babel   →   Babel plugin for esbuild.

esbuild-plugin-postcss-literal   →   PostCSS tagged template literals plugin for esbuild.


Keywords

FAQs

Package last updated on 15 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc