0.8.2 • Published 5 years ago

svg-inline-loader v0.8.2

Weekly downloads
197,965
License
MIT
Repository
github
Last release
5 years ago

npm deps test coverage chat

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

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.

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

// 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:hash: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'
    }
@knapsack-cloud/msk-design-systemblowpacksvn-controle@nestagencyuk/react-componentsvis-gadgettest-create-libraryreact-scripts-diaverum-commonrete-two-editortwintwoo-editor@c11/engine.cli-service-web@fizzmod/devserver@enaviga/client-components@infinitebrahmanuniverse/nolb-svg-@troyanym/front-uimapintegratedvuer-12labours@everything-registry/sub-chunk-2858svg-sprite-vue3tarantulajstabby-web-demoweather-widget-reactvussrvv-ui-kitwildplatexes-webpack-coretest-zuoguangcheng-npmsvg-sprite-francessy-components-testthanix-iconsetvideojs-player-custom@dp-instant/game-template@dosvit/app-framework@dallin343/chisel-cms@design-express/node-scripts@coveops/vimeo-thumbnail@coveops/date-range-picker@coveops/dual-field-facet-slider@coveops/folder-view-search@coveops/microsoft-dynamics-365-components@c11/engine.service-webjdescottes-devtools-launchpadio-sanita-themejupyter-widget-stixviewkk-api-cli-lib-1customised-mapintegratedvuerstixviewsolid-file-widgettimekit-bookingtwikoos@airiot/devtool@aqsi/scripts@app-proto/ify@asinc/wp-webpack@akqa-frontline/image-config-webpack-plugin@alonetrojan/sy-components-test@awkward/webpack-config-sketch-web@axio/react-scripts@chicagomaroon/react-crossword@centroculturadigital-mx/ccd-sistema-diseno@12-labours/mapintegratedvuer3box-comments-react3box-profile-edit-react3box-chatbox-react3box-chatbox-react-enhanced@bernardmcmanus/webpack-config@constgen/neutrino-svg-loaderyii-steroidsycommentsyoshi-fork-teamcityyyl-base-webpack-configyyl-seed-webpack-vue2vue-rotate-captchawby-react-scriptswebpackpluto.jlwebpack-kit-presetswebpack-config-aswebpack-script-clits-react-uiunder-one-roof-webzdean-vue-js@feng-lab/neuroglancer@fishawack/config-grunt@fishawack/core@groupher/editor-collapse@groupher/editor-column@groupher/editor-delimiter@groupher/editor-embed@groupher/editor-list@gtiot/iot-devtool@embedded-banking-fundr/rabobank-landing-page@fratercula/falco@geoffdavis92/eleventy-plugin-webpack@lorndev/webpack-core@interaktiv/dia-scripts@itron/makeover@m-fe/webpack-config@mozilla/factor-ui@maraschino/cherry@material-delivery/docs@newsteam/legacy-webpack-config@nail-cli/core
0.8.2

5 years ago

0.8.0

8 years ago

0.7.1

9 years ago

0.7.0

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.0

9 years ago

0.4.1

9 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago