1.0.4 • Published 11 days ago

@teamteanpm2024/corrupti-iusto-inventore v1.0.4

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

@teamteanpm2024/corrupti-iusto-inventore

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 @teamteanpm2024/corrupti-iusto-inventore
# using pnpm
pnpm install -D @teamteanpm2024/corrupti-iusto-inventore
# using yarn
yarn add --dev @teamteanpm2024/corrupti-iusto-inventore

Usage

Vite config

import { svgSpritemap } from '@teamteanpm2024/corrupti-iusto-inventore';

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.
outputastarktypegetpromisescollection.es6callbindtscssfseventsECMAScript 2017iteratetranspileharmonyshrinkwrappatchfindfullworkersharedwgetprotocol-bufferssetImmediatevaluescallboundreact-hookssymbolstringajaxrmArrayBuffer.prototype.slicereadparsernopeReactiveExtensionslinkcircularmakereact-hook-formbyteentriescodesparentstructuredCloneECMAScript 6YAMLgenericscachedirconfigurableavaclassescliuuidECMAScript 2021hasruntimestyled-componentsisUint8ClampedArraydescriptionperformancepurevarless.jslimitlengthtestercolorObject.isArray.prototype.containsstylestapefastES2021schemekeyhttpqueryscheme-validationECMAScript 5class-validatorclassnamestyleguidenameprotobufcmdurlsutilitystreams2fastifyjavascriptcall-bounddayjsboundparsereal-timemkdirpwebsiterobustmonorepoyupsuperstructutilbannertddfunctionmake dirfullwidthdeepcopyequalitypropertyeventEmittercharacterdropidwatchFilefast-deep-copybundlingcss nestinggetintrinsicopenfsoffsetspinnertextwhichlimitedutilitiesshellcore-jses8autoprefixerdatastructureajvcryptoflatserializemime-dbjsxfileclonefast-copybootstrap cssgradients csssetPrototypeOffilterstringifyletbyteLengthcomputed-typesoperating-systemquoteredactobjhandlerses-abstractvisualArray.prototype.flattenes6pnpm9jssymlinkJSONmobilepropertieseslintconfigStreaminvariantUnderscorecorsTypeScriptObject.entriesauthenticationurlwhatwgsafeairbnbuser-streamsbabelargsvalidateresolvecallbackwritabletestlinewrapsequencestyleIteratorCSSserializerextensioninputhardlinksvalidatordomInt16Arraylintlockfilehashstreamiteratorvalidationopenercurriedframerpolyfilltelephoneaccessibilitywatcherio-tsupcurlqserrorindicatorObject.definePropertycolorscryptcss-in-jsCSSStyleDeclarationArrayBufferarraysflattenFunction.prototype.namewindowsSymbol.toStringTagES2017ES2022envassignJSON-Schema_.extendObject.valuesmimecompile lessrm -frenumerablexdg-openObservablessuperagentregular expressionUint32ArrayStreamsbddmatchesparentsURL6to5queuepersistent.envdataviewefficientECMAScript 2018mergeES2016walkingrecursiveemojiiterationprototypexhrreduceeventDispatcherjson-schema-validatorflagmochastylingURLSearchParamsreactdatagradients css3formtypedarraysformsreduxObjectintrinsicES3Float32Arrayjson-schema-validationjson-schema-0multi-packagethreehelpersdirectorypackagecss lessWebSocketdragassertsFloat64Arrayvariablesnamesless mixinstypeofratemru@@toStringTagterminallooktimesideES7transpilergetoptdependency managerexitqueueMicrotaskequaltestingfetchspawnutil.inspectcopyECMAScript 3hookscreatetrimRightdebugless compilerexpressiondefaultinterruptsECMAScript 2016functionslanguagetypesafepassword__proto__exereducerpushspinnersconstless cssES8toolswarningansiRFC-6455symbolsmacosimmutablereadablestreamcallfindupestreeeventsprogressargparseaccessorappuninstallartcensorttyhigher-ordertoStringTagexit-coderamdaponyfilli18nInt32ArrayString.prototype.matchAllECMAScript 7es5esgroupBydeterministicsigintlinuxsortnpmbrowserwatchstartrapidkoreansomefastcopyESnextmodulesfull-widthsanitizationtoolkitflatMapstatusjapanesenegativetypeerrorfunctionalpathencryptionvalidslicehttpsthroatgetOwnPropertyDescriptorMicrosoftunicodetaskbabel-coreenderlaunchcall-binddiffsyntaxerrormapsigtermvalueincludeses7pipebindloggergesturestapObject.getPrototypeOfdependenciesmimetypesduplexhasOwnsignalspackagesObject.keysframeworkguidshamfantasy-landirqgettertrimbatchwaapicss variablekarmaRxJSquerystringfromcommand-linefoldererror-handlingwordbreakpyyamlprocessrangeerrorWebSocketsconsumezodomitreusechildpopmotionsameValueZerosyntaxidletrimStartdefinePropertyassertionObject.assignescapebufferES2015es2018signalprivateopensrandomReactiveXtrimEndmkdirs3dprivate datatoSortedlistenerslazyeveryextragdprjsdiffbyteOffset$.extendcolourmomentapollodefinecommandArray.prototype.flatMapwalksymlinksArray.prototype.includesstreamswatchingBigInt64ArrayArray.prototype.filteres-shim APIsettingsjsontypanionweaksetobjectform-validationpluginObject.fromEntriesconcatMapECMAScript 2023regexpjsonpathargumentisConcatSpreadablebrowserslistdeepcloneutilsviewtraversetermbreaktyped arraypropwebeslint-plugina11yasynccolumnscollectiondeletemiddlewarestylesheetcoercibledebuggerformattingstarterexpressfile systemregular expressionsclientlastnegative zeroglobbusyECMAScript 2015ES2023Setpostcss-pluginpostcssinternal slotes2016Uint16Arrayconcatimmerapitc39optimistconnecttypesextendES2020awaitPushPromisewrapxtermcheckinstallfast-deep-clonepreserve-symlinksarraybuffer[[Prototype]]WeakMapTypedArrayl10n
1.0.4

11 days ago

1.0.3

12 days ago

1.0.2

13 days ago

1.0.1

14 days ago

1.0.0

14 days ago