All Projects → webpack-contrib → Svg Inline Loader

webpack-contrib / Svg Inline Loader

Licence: mit
Inline SVG loader with cleaning-up functionality

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Svg Inline Loader

Svg Fill Loader
DEPRECATED, use https://github.com/kisenka/svg-mixer/tree/master/packages/svg-transform-loader instead
Stars: ✭ 74 (-84.9%)
Mutual labels:  webpack-loader, svg
React Svg Loader
A loader for webpack, rollup, babel that loads svg as a React Component
Stars: ✭ 570 (+16.33%)
Mutual labels:  webpack-loader, svg
Webfonts Loader
Make an icon font from SVGs!
Stars: ✭ 153 (-68.78%)
Mutual labels:  webpack-loader, svg
Svgr
Transform SVGs into React components 🦁
Stars: ✭ 8,263 (+1586.33%)
Mutual labels:  webpack-loader, svg
Vue Svg Inline Loader
Webpack loader used for inline replacement of SVG images with actual content of SVG files in Vue projects.
Stars: ✭ 105 (-78.57%)
Mutual labels:  webpack-loader, svg
Svg Sprite Loader
Webpack loader for creating SVG sprites.
Stars: ✭ 1,822 (+271.84%)
Mutual labels:  webpack-loader, svg
Svg Url Loader
A webpack loader which loads SVG file as utf-8 encoded DataUrl string.
Stars: ✭ 217 (-55.71%)
Mutual labels:  webpack-loader, svg
Svgedit
Powerful SVG-Editor for your browser
Stars: ✭ 4,674 (+853.88%)
Mutual labels:  svg
Font Spider
Smart webfont compression and format conversion tool
Stars: ✭ 4,550 (+828.57%)
Mutual labels:  svg
Line Charts
A library for plotting line charts in SVG. Written in all Elm.
Stars: ✭ 445 (-9.18%)
Mutual labels:  svg
Iconify
Universal icon framework. One syntax for FontAwesome, Material Design Icons, DashIcons, Feather Icons, EmojiOne, Noto Emoji and many other icon sets (90+ icon sets, 80,000+ icons).
Stars: ✭ 439 (-10.41%)
Mutual labels:  svg
Feather
Simply beautiful open source icons
Stars: ✭ 21,029 (+4191.63%)
Mutual labels:  svg
Canvas2svg
Translates HTML5 Canvas draw commands to SVG
Stars: ✭ 467 (-4.69%)
Mutual labels:  svg
Philter
Philter is a JS plugin giving you the power to control CSS filters with HTML attributes.
Stars: ✭ 445 (-9.18%)
Mutual labels:  svg
Elm Charts
Create SVG charts in Elm.
Stars: ✭ 482 (-1.63%)
Mutual labels:  svg
Scour
Scour - An SVG Optimizer / Cleaner
Stars: ✭ 443 (-9.59%)
Mutual labels:  svg
Miaou
A chat server with OAuth2 authentication, persistent and searchable history, video and audio, markdown formatting, private and public rooms, stars, votes, embedded games, and many other features
Stars: ✭ 486 (-0.82%)
Mutual labels:  svg
Github Corners
A fresher "Fork me on GitHub" callout.
Stars: ✭ 4,583 (+835.31%)
Mutual labels:  svg
Webvowl
Visualizing ontologies on the Web
Stars: ✭ 459 (-6.33%)
Mutual labels:  svg
Radiance
Building modern, elegant and fast Swing applications
Stars: ✭ 458 (-6.53%)
Mutual labels:  svg

npm deps test coverage chat

! NO LONGER MAINTAINED !

This module is deprecated and will no longer be maintained.

In most cases, you can replace the functionality by using raw-loader and image-minimizer-webpack-plugin instead:

webpack.config.js

const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin');

module.exports = {
  module: {
    rules: [
      {
        test: /\.svg$/,
        use: [
          {
            loader: "raw-loader"
          }
        ]
      },
    ],
  },
  plugins: [
    new ImageMinimizerPlugin({
      minimizerOptions: {
        plugins: [
          [
            'imagemin-svgo',
            {
              plugins: [
                // SVGO options is here "https://github.com/svg/svgo#what-it-can-do"
                {
                  removeViewBox: false,
                  removeXMLNS: true,
                },
              ],
            },
          ],
        ],
      },
    }),
  ],
};

For optimization svg use imagemin-svgo.

SVG Inline Loader for Webpack

This Webpack loader inlines SVG as module. If you use Adobe suite or Sketch to export SVGs, you will get auto-generated, unneeded crusts. This loader removes it for you, too.

Install

npm install svg-inline-loader --save-dev

Configuration

Simply add configuration object to module.loaders like this.

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

warning: You should configure this loader only once via module.loaders or require('!...'). See #15 for detail.

Query Options

removeTags: boolean

Removes specified tags and its children. You can specify tags by setting removingTags query array.

default: removeTags: false

removingTags: [...string]

warning: this won't work unless you specify removeTags: true

default: removingTags: ['title', 'desc', 'defs', 'style']

warnTags: [...string]

warns about tags, ex: ['desc', 'defs', 'style']

default: warnTags: []

removeSVGTagAttrs: boolean

Removes width and height attributes from <svg />.

default: removeSVGTagAttrs: true

removingTagAttrs: [...string]

Removes attributes from inside the <svg />.

default: removingTagAttrs: []

warnTagAttrs: [...string]

Warns to console about attributes from inside the <svg />.

default: warnTagAttrs: []

classPrefix: boolean || string

Adds a prefix to class names to avoid collision across svg files.

default: classPrefix: false

idPrefix: boolean || string

Adds a prefix to ids to avoid collision across svg files.

default: idPrefix: false

Example Usage

// Using default hashed prefix (__[hash:base64:7]__)
var logoTwo = require('svg-inline-loader?classPrefix!./logo_two.svg');

// Using custom string
var logoOne = require('svg-inline-loader?classPrefix=my-prefix-!./logo_one.svg');

// Using custom string and hash
var logoThree = require('svg-inline-loader?classPrefix=__prefix-[sha512#️⃣hex:5]__!./logo_three.svg');

See loader-utils for hash options.

Preferred usage is via a module.loaders:

    {
        test: /\.svg$/,
        loader: 'svg-inline-loader?classPrefix'
    }

Maintainers

Juho Vepsäläinen Joshua Wiens Kees Kluskens Sean Larkin
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].