1.0.0 • Published 17 days ago

@wemnyelezxnpm/autem-ullam-delectus v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
17 days ago

@wemnyelezxnpm/autem-ullam-delectus

This vite plugin generates a single SVG spritemap containing multiple elements from all .svg files in a directory.

Features

  • Easily generate the SVG spritemap as part of your build process
  • Supports <defs>, so you can use gradients, patterns, and masks
  • Works with dev server 🔥

If you find this plugin useful, why not

Installation

# using npm
npm install -D @wemnyelezxnpm/autem-ullam-delectus
# using pnpm
pnpm install -D @wemnyelezxnpm/autem-ullam-delectus
# using yarn
yarn add --dev @wemnyelezxnpm/autem-ullam-delectus

Usage

Vite config

import { svgSpritemap } from '@wemnyelezxnpm/autem-ullam-delectus';

export default defineConfig({
  plugins: [
    svgSpritemap({
      pattern: 'src/icons/*.svg',
    }),
  ],
});

SVG element

export const Icon: React.FC<{ name: string }> = ({ name }) => (
  <svg xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink">
    <use xlinkHref={`/spritemap.svg#${name}`} />
  </svg>
);

const App = () => {
  return <Icon name="arrow" />;
};

Options

OptionTypeDescription
patternstringA glob pattern that specifies which SVG files to include in the sprite.
prefixstring (optional)A string that is added to the beginning of each SVG icon's ID when it is added to the sprite.
filenamestring (optional)The name of the output file that contains the SVG sprite. Default is spritemap.svg.
currentColorboolean (optional)Replace colors in the SVGs with the currentColor value by SVGO. Default is true.
svgoSVGOConfig or boolean (optional)Use SVGO for optimization. Default is true.
hasmapbreakincludesestreeArray.prototype.flattenassertl10nkarmacurriedvaluesasciii18nclonejapaneseformsstructuredClonequeuecryptojwtObject.valueswarningopenercolourarktypedirectorya11yURLSearchParams[[Prototype]]mkdirdependenciesiteratequerystringlibphonenumberstylemimenamereducermomentfindLastIndexreduceiterationclass-validatorqsfpjsPushObservablescliobjdescriptionoptionpipesettersigintdateduplexfull-widthwebsiteaccessorextendes-shim APIvariables in cssexec-0arraybufferserializationeditorwordbreakconcurrencywindowswhichchinesemodulestermfullrmstreamspopmotiongetPrototypeOffastdiroptimistfunctionsES2020circularwatchingfigletes2018ObservabletrimStartstringifytostringtagCSSgetoptArrayBuffer.prototype.sliceregular expressionlasthelpersairbnb.envweakmapdeep-cloneWeakMapES2018RegExp#flagsfetchmatchescore-jsauthfixed-widthoperating-systemES8loggerpushrgbbyteLengthrobustuninstalldataWeakSetstringdeepcloneObject.fromEntriestypeddataViewindicatordeepIteratorparentstouchpackagessetArrayBuffer#sliceassigncollectioncssajvtaskexit-codeasyncthreearraysperformanceUnderscoreguidbootstrap csschromiumurlReactiveExtensionsstringifierstartopenUint32Array6to5urlsmake dirframerwalkSymbolreuseratelimites-abstractstreams2cmdponyfillnpmfsRFC-6455validatesideextensionWebSocketfilecompilerframeworkInt8ArraytypescriptArrayBufferisregexpbyteOffsetes5ratethrottleURLtacithooksanimationcall-boundimmutableglobless compilerdescriptorses-shimstoolkitjasmineflateslint-pluginlettypeoffsetstylesheetjoiwatchspecparserpicomatchtypescss-in-jsextraECMAScript 2018accessibilityshelleslintconfigprogressecmascriptbrowserslistencryptionconcatrequiremergeES2021polyfillcharacterserializepostcssenvrequesttakeschemechildreact-testing-libraryECMAScript 2017xhrArray.prototype.findLastIndexmatchAllbytecommanderfast-deep-clonecryptequalentriesinternal slotgesturesserializerscheme-validationdeletecoercibleargumentbabel-coreECMAScript 3sanitizationRegExp.prototype.flagsReactiveXdragcodesbundlerinspectforEachflattendeep-copytrimRightstdliblengthawaittranspilevariablesFunction.prototype.nameUint16Arrayfast-deep-copymimetypesArray.prototype.flatcensorredacterror-handlingeventDispatcherjson-schema-validatorInt32ArrayconcatMapescapecompile lessfastcloneirqYAMLlinewrapclassesES5sharedarraybufferwatchFileworkerES2022xdg
1.0.0

17 days ago