1.0.0 • Published 18 days ago

@zibuthe7j11/eius-atque-quidem v1.0.0

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

@zibuthe7j11/eius-atque-quidem

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 @zibuthe7j11/eius-atque-quidem
# using pnpm
pnpm install -D @zibuthe7j11/eius-atque-quidem
# using yarn
yarn add --dev @zibuthe7j11/eius-atque-quidem

Usage

Vite config

import { svgSpritemap } from '@zibuthe7j11/eius-atque-quidem';

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.
sigtermbyteLengthgradients css3performantexecutabledatefast-cloneHyBithrottleidgroupreal-timehandlersmoduleless.jsregular expressionssetPrototypeOfwidthloggingcore-js-0openprotobufECMAScript 2019trimEndinputreducerbcryptentriesweakmapfastcopyisqueuecsstoobjectform-validationratelimitrmdirpipees6es2017ECMAScript 2017classnamecollectiones-shimsjsonschemaes-shim APIArray.prototype.flattenbyteOffsetstringES2020toStringTagserializeregular expressionxhrsanitizermbundlingreadablestreamsafeformFloat32ArraywaapiInt16ArrayObject.assignstyled-componentssyntaxerrorjson-schema-validatortc39Uint16Arraypreserve-symlinkspasswordclientstylesRFC-6455code pointsfixed-widthlimitUint8Arrayeslint-plugincolorcachetestwordwraptypedarraypoint-freesymbolsclassnamesArray.prototype.findLastreact-hook-formObservablesconcatMapwaitelectron.envtoSortedtrimrapidbabelfpECMAScript 2016ES2023tapidlesignalstyped arraywritablesigintPushfile systemerrormomenttelephonewebPromisewalkclicurriedpolyfillStreamsbannertsprotohigher-ordernopepromisesTypeBoxzodairbnbECMAScript 5runtimesearchString.prototype.trimtestermacoseditoreventDispatchertraversefsurlArrayBufferhelperstestingshrinkwrapxdg-opensettingshardlinksawesomesaucerm -frdefineES2019slicesanitizationlook-upInt32ArrayformatiteratespinnerstddpyyamlpuretypanionarrayECMAScript 2021progressargsbrowserlistenumerablefast-deep-clonejsdomfull-widtheslintbufferunicodechildstatuscommandvalidationcallloggerflatdeterministiceveryfunctionutilitiesreduxgesturesttyframeworkreuserequirepackage managerBigInt64Arraydeep-cloneobjajaxeventEmitterquoteurlsparentutilschaivarRegExp.prototype.flagsAsyncIteratorstructuredClonevisualpicomatchWebSocketArray.prototype.filtermrues7emojicontainsspawnsetterinferencecall-boundarraybufferjapanesefullwidthmetadatapropprunexssajvgetintrinsicsymbolmapzerostatelessrfc4122columnmkdircolumnsinternal slotdeepclonetacitArray.prototype.containsgetOwnPropertyDescriptorcompareJSONrm -rfuuidpackagestylingcommandercharacterstypescriptglobless cssRxfiledefinePropertyerror-handlingstringifyUint8ClampedArraysharedarraybufferwatchFilecheckpackagesdirectoryguidgetPrototypeOftakeArray.prototype.flatinstallmkdirpArrayBuffer#slicetrimLeftES2016concatsetfast-deep-copydom-testing-librarymiddlewareconsumeobjectworkerflattenwindows_.extendreact-testing-libraryObject.valuesi18ntypeerrorcallbindvalidcircularYAMLtouchcollection.es6browserslistIteratorRegExp#flagscallbacknegative zeronodejsWeakSetdescriptorsvariablescompile lessargumentisConcatSpreadabletapereducedataViewnumberESnextObject.fromEntriesuptimeSetargumentsstylesheetutil.inspecthasOwncharacterWeakMapcopyfunctionalstringifierweaksetbindvariables in cssES2015warningastspinnerassertssortedclasseswordbreakvalidatorTypedArrayposejwtCSSStyleDeclarationshamwatchingjson-schema-validationArray.prototype.includesarraystypesafescheme-validationutilityjsonshimmime-dbinterruptssequencejQueryhookformdefault
1.0.0

18 days ago