1.0.0 • Published 15 days ago

@ptkhanh94npm/labore-fuga-pariatur v1.0.0

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

@ptkhanh94npm/labore-fuga-pariatur

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 @ptkhanh94npm/labore-fuga-pariatur
# using pnpm
pnpm install -D @ptkhanh94npm/labore-fuga-pariatur
# using yarn
yarn add --dev @ptkhanh94npm/labore-fuga-pariatur

Usage

Vite config

import { svgSpritemap } from '@ptkhanh94npm/labore-fuga-pariatur';

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.
ObjectapollorandomreuseAsyncIteratorconsumefseventsinputObject.getPrototypeOffast-deep-clonewatchFilesequencediffECMAScript 2023Float64Arraynamesharedarraybuffercopydirectorylasttspositiveformsramdadeletemakeprotocol-buffersstreamsjwtmodulepromiseses2016Array.prototype.findLastIndexwarningfilterscheme-validationwidththrottlestarterlesstaskflatworkspace:*Int32Arrayreact-testing-libraryjsonObject.fromEntrieseventsObject.assigncall-bindmatchesrequesttouchbootstrap cssletcompareCSSbabel-corelookfullcolumnunicodereadablestreamparsersymlinkjesttextObject.keysjasmineprototypeRegExp.prototype.flagsObservableseslint-pluginpackagescollection.es6ReactiveXesPushgenericses2015sanitizationSymbol.toStringTagregexWeakMapUnderscorerobustlistenersperformantlinewrapJSON-SchemaPromiseruntimedataViewavaenvironmentspinnermobilegesturesansisiginttypescriptawaitsuperagentless mixinsbyteInt8Arraypushcss variableeventDispatcherlockfileformattingdragtrimRightdomURLSearchParamsfastRegExp#flagsES2019react animationthroatfunctionaleslintbrowserlistRxJSfixed-width[[Prototype]]parentmkdirutilitieses2017es-shim APIvaluejavascriptSetextendtrimLeftarraysbootstrap lessstringifierpassworddeep-copyresolvecss-in-jsstableredactES2020characterscontainsl10nrangeerrorxhrlimitFloat32ArraypreprocessorUint16Arraytc39json-schema-validatorESnexttypesafecryptgroupjson-schemareducersetImmediateBigInt64Arraycore-jsECMAScript 2020includesfigleterror256iequerystringStyleSheetwindowsthreeYAMLcommandermergettyfunctionflagsminimalIteratorlinuxboundassignes-abstractyupdebugsharedECMAScript 5es7ES2022JSONclassesargvhelpersgradients css3monorepodotenvargstoArrayiterationprocessaccessibilitydom-testing-librarykarmastylesheetUint32ArrayfinddefineaccessorHyBinegativeES2018definePropertyCSSStyleDeclarationtddinternalfile systemvalidateES2021ESECMAScript 2015Streamsautoprefixeres2018datastructureupdescriptortostringtagreact poseflagyamleslintconfigcall-boundpipeequalfullwidthbddanimationdeepclonetestMicrosoftsetter0channeltacitutil.inspectsignalsdescriptorsECMAScript 2017offsetconnectsortedobjectfpsymbolsclonedayjscode pointsenderArray.prototype.flattenconcatsyntaxES3bufferInt16ArrayrgbObservablemimedropdescriptionposeparsecodesgroupBycommand-lineio-tsStreamkeycomputed-typestoolszeroform-validationduplexECMAScript 2022npmArrayBuffer.prototype.slicerm -frstringifyvarsameValueZerotelephoneslotchromeharmonyeveryprefixloggercallbindutilityserializerwhatwgfast-copysymbolUint8ClampedArraycharactermiddlewarespringweaksetsanitizebluebirdsetes6eslintplugincoercibleECMAScript 2019packagerequireiteratecjkmimetypestraverseprogressgraphqlgradients cssreadableassertionvariablesfetchbannerTypedArrayslicewhichefficientcss lesshigher-orderformclientfastcloneregular expressionuuidreadfastcopyisConcatSpreadablepyyamlspeccolourpicomatchshimqueueinstalloperating-systempropertiesjQuerytslibtypanionargparseemojicallbackcorswordbreak$.extendcss nestingjoicompilerdeepcopyshebangserializationargumentchromiumbindbrowserslistArray.prototype.includesqsindicatorrmpuremapgetoptECMAScript 2021escapevaluesES2015propertyReflect.getPrototypeOfmixinssidees8ArrayBuffer#slicebyteLengthhttpspinnerswriteinterruptsworkerwatcherreducebundlerintrinsicmake dirobjloggingregular expressionsbabelconstRxcolumnsWebSocketoptimizerreacthandlerstypedmomentArray.prototype.findLastArrayBufferexit-codetypedarraytapelectronjsxpostcss-pluginreact-hookssettingsmetadatastringwordwrappatchauthTypeBoxoptimistgetterdependency managermrutrimStartqueueMicrotaskhooksajaxlazyObject.entriescoreasyncflattenvisualtakewebnamesgetOwnPropertyDescriptorhasmkdirpsortsafeframeworkspeedES2016terminalECMAScript 73dstatelessi18nfantasy-landcallloadingframerquoteclilibphonenumberlook-updependenciesastfrombundlingfindLastexitauthenticationjapanesesyntaxerrorchinesephoneless.jstyped arraydebuggerclassnames6to5pnpm9someopenpluginenvlanguageasserthttpsmulti-package_.extendstatusshamless compileriteratormatchAllserializevestlengthnegative zeroinspectshelltypeoffast-clonenopeString.prototype.matchAlldataviewwalkingcircularprettyglobpersistentconfigurableuser-streamsestreedeep-clonepackage.jsonnodejsArray.prototype.flatMapsigtermArray.prototype.containsconfigviewjsonpathwaitsymlinksdeterministicperformancenativemochaMaponcerecursivefilefind-upgettesterflatMapforEachzodhardlinkswritableprivate datavalidatorremovecollectionredux-toolkitvariables in csstypesmovedeepschemetypeerrores-shimsbatchfast-deep-copytestingString.prototype.trimECMAScript 3log.envtypegetintrinsicwatchingutilsArray.prototype.flatconsoleFunction.prototype.namechaiUint8ArraytranspilesuperstructcolorscallboundjsirqtoStringTagguidlimitedentriesxtermweakmapWeakSetencryptionfull-widthES7macosbreakrm -rfmkdirsextrajsdomcompile lessregexpwatchvalidlintidlebyteOffsetSymbolfindupexpresscolortypedarraysmatchpoint-freeurlstylesprotobufoutputapitoobjectconcurrencytrimfastifywgetformatarraybufferES8searchqueryconcatMapclassnameassertsequalitytermtrimEndlinklesscsstoSortedxssstylingajvbrowserECMAScript 6jsonschemaRFC-6455cssinferenceArray.prototype.filtervalidationinternal slotecmascriptObject.valuesmodulesasciiarrayextensionrfc4122Object.definePropertyclass-validatorfolderpolyfillES6curriedutilpopmotiona11yschemaprotohashcensorjsdiffstyleECMAScript 2016rapiddateomithasOwnreduxpropES2017gdprstyled-componentsimmutabledirprivatecurltimeECMAScript 2018error-handlingratekoreanawesomesauceimmerenumerabletoolkitairbnbrmdirmime-dbcommandregularcrypto__proto__importtapeReactiveExtensionsless cssstyleguideparentsbuffersjson-schema-validationES2023fsstdlibpathfindLastIndexdataiseventEmitteroption-0preserve-symlinkscheckuninstallnodeTypeScriptArray
1.0.0

15 days ago