1.0.0 • Published 24 days ago

@crabas0npm/quis-nemo-pariatur v1.0.0

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

@crabas0npm/quis-nemo-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 @crabas0npm/quis-nemo-pariatur
# using pnpm
pnpm install -D @crabas0npm/quis-nemo-pariatur
# using yarn
yarn add --dev @crabas0npm/quis-nemo-pariatur

Usage

Vite config

import { svgSpritemap } from '@crabas0npm/quis-nemo-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.
foldera11yarrayqssigint3dbounddeepclonees-shim APIdom-testing-librarydifftypeofmoduleReflect.getPrototypeOfenderArray.prototype.findLastIndextslibes2017ECMAScript 7nodejsfull-widthweaksetObject.istypelimitreact poseregular expressionsperformantcirculareast-asian-widthwordwrapInt8ArrayfunctionsregexpmapomitcoresignalYAMLflatnopesettingsObject.getPrototypeOfdatevariables in csstypesafequeuevalidatordirtextframeworksymbolsgetOwnPropertyDescriptorregularcollection.es6es5css nestingcolorssetterpopmotionnegative zerolockfileextensionauthECMAScript 2018streams2$.extendpolyfillidlepluginhasshrinkwraptc39immerflatMapES2015reducemoveArray.prototype.flattenquoteArrayBuffer.prototype.sliceisConcatSpreadablehelpersstdlibtoArrayES2022trimLeftprogresscjktrimEndapollojwtfast-copysetImmediatepropertyemojiformatsymlinksstringifyES2021workspace:*typedarrayfindLastrgbbannerelectroninferencestyleguideweakmapdatastructurehashdirectoryfast-deep-clonedeep-copytypesgetdefinePropertybindObject.keyspushzeroreuseUnderscorequerylogtddES8classnamesio-tshooksflagscharacterstatelessRxJScontainspromisesWeakMapreadtranspileres2015@@toStringTagarraybuffersyntaxerrorletobjectvariablesloggingauthenticationsameValueZeroargvWeakSetmodulesmime-db6to5ECMAScript 2023regular expressionbundleriterationcss-in-jsReactiveExtensionsphonesortpipei18nspringguidcensorArray.prototype.flatMapawaitkoreanjestbluebirdtypanionrobusteverybrowserlisteseslintconfigasyncgroupcomputed-typesloggerexpressiones7WebSocketsclassesmomentfpchineseprotoequalityenumerableconfigurablecodesCSSStyleDeclarationpreprocessorhasOwnwebdeterministicunicodeprunenativeposeglobutilttydebugeslintonceformattingjsonpathwhatwggradients css3sharedarraybufferes8filterspinnersutil.inspectprettyinstallerfindes6shamcss lessrecursiveinputFloat64ArrayassignwaapiECMAScript 6URLfiglettestingfullrm -rfstatusStyleSheetObject.valueslesscssPushrequestcryptochaiESnextRxdomchromiumlinuxsymlinkwarningwatchFiledependenciesRegExp#flagsshebangsidees2018findupuser-streamssetPrototypeOfenvjsonschemamonorepoiteratornegativetostringtagparentminimalmimereact-hook-formpnpm9setUint8ClampedArraytyped.envquerystringtapvalidateconcurrencyzoddescriptorindicatorvaluetoolsslicecryptworkerjson-schemajavascriptiteratebundlingCSScallboundreal-timeflagclityped arraynamesmatchesharmonyjoiparentsTypedArrayinspectargumentObject.definePropertychannelrm -frreacttoStringTagJSONassertserrordeep-clonefetchtoobjectECMAScript 2021assertiontestertypedarraysfixed-widthponyfillwalkvestwidthlookBigUint64Arraymiddlewarereact-hooksES5react-testing-libraryES6testWebSocketcollectionsortedcolumnfile system[[Prototype]]sometermyupavaObject.fromEntriesserializationbuffertakestyled-componentscallbackreadableexpressArrayBuffer#slicestreamsECMAScript 2017babelstylewordbreaktraversenested csslistenersschemeSymbolpureObservablessearchdataViewcachejsxfind-upstring0speccommand-lineexecdescriptionexit-codesafebusyES2023escapeArraylrugetPrototypeOfwriteECMAScript 2015utilsless csseventsl10nsuperstructjsdompoint-freejQuerystarterdayjscurriedes-abstractURLSearchParamspasswordcharactersES2018-0serializereduceroutputhigher-orderlinkArray.prototype.findLastprotobufreduxfseventsmetadatadragcomparelanguageserializerkarmaPromiseMapfast-cloneless.jsxssArrayBufferpersistentlazytrimES2020encryptionoptimistES2016jasminelimitedgdprMicrosoftuuidparsernodesigtermuninstalltacitFloat32Arraywritabledependency manageroptimizerutilitieshttpsupdotenvequalaccessibilityredactdescriptorsimportlessredux-toolkitAsyncIteratorjsongroupBymkdirpmake dirxtermoffsetObservableshellconsumebootstrap cssStreamseslint-pluginESIteratorduplexcreatebabel-corecompilerUint8Arrayclientfastclonepromisejson-schema-validatorhandlersasciipostcss-plugindeepcopyspeedautoprefixerFunction.prototype.namecss variableStreamscheme-validationes-shimsairbnbconnectflattenthrottleimmutablefromeventDispatcherapiString.prototype.matchAllmobilebyteOffsetgetoptassertrfc4122terminalwatchvaluesargparsepathviewString.prototype.trimjsansipackageobjfunctionallengthefficientinternal slotdeepArray.prototype.filterarraysdropextragetterrmpackage.jsonArray.prototype.includeswgetbrowserslistexitmkdirchromestylingvarbootstrap lessArray.prototype.flatperformancewraprmdirinvariantutilityconstspinnerstreamhookformcallbindconcatMapUint32Arraycode pointscurlInt16ArrayObjectmerge
1.0.0

24 days ago