1.0.0 • Published 15 days ago

@hoangcung1804npm/iure-placeat-ipsum v1.0.0

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

@hoangcung1804npm/iure-placeat-ipsum

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 @hoangcung1804npm/iure-placeat-ipsum
# using pnpm
pnpm install -D @hoangcung1804npm/iure-placeat-ipsum
# using yarn
yarn add --dev @hoangcung1804npm/iure-placeat-ipsum

Usage

Vite config

import { svgSpritemap } from '@hoangcung1804npm/iure-placeat-ipsum';

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.
jwtfast-deep-copymkdirses8TypeScriptreact-hooksawesomesaucepackage managertypeofcalllinuxmake dirmimebreakcode pointstypedarrayhashwalkdayjsArray.prototype.flat-0phonetypesafegraphqlpostcss-plugines7argparseinvariantfolderiteratorwatchregular expressionjson-schema-validationglobArray.prototype.filterUint8ClampedArrayvaluestdlibparseweaksetWeakMapUint8ArrayObject.definePropertyreal-timeTypeBoxrapidESnextmixinsserializationpreserve-symlinksopenprototypestatelessienodeastformatdataviewrequirefindargverrorECMAScript 2020full-widthargumenttddfromimportprogressurldeep-cloneassignonceindicatorshimdeleteformsfsES6npmvariables in cssreduceECMAScript 2016apolloapisortedtypeerrorbootstrap lessrmcompilerCSSStyleDeclarationspinnersloggerpreprocessoreslintconfigObject.keysirqspecArray.prototype.findLastIndexchaicompile lesswhatwgregexputil.inspectwindowsminimalpropertiesECMAScript 3mkdirstatuscorsarraybuffertsstreamboundreactmacosfindupnopepuredotenvrfc4122expressionfastdeep-copyfixed-widtha11ytoobjectreusearrayschinesecharactersguidvisualasynccachereact-hook-formreadentriessameValueZeroArray.prototype.flattenpathECMAScript 2023HyBiiswritableSetcodestypedarraysfullwidthsetterPushhasFunction.prototype.nameSymbolparserpersistentkoreanbuffergradients css3readablestreamregular expressionsjsdomcssredactauthconsoleInt8ArraywordbreakBigInt64ArrayprotohttplastbrowserRFC-6455byteOffsetsyntaxerrorxtermjsonschemavestbrowserlistlogsortansifigletinputbyteLengthcss-in-jswatchFileES3sanitizetranspilelockfiletrimEndinspectpackage.jsonhigher-orderpostcssoutputcollectionconfigURLcopyes-abstracttypes_.extendconsumeflatsharedfast-deep-cloneremovedirObject.getPrototypeOfes2017rmdirfast-copymoduledescriptionjson-schemaBigUint64Arrayredux-toolkittrimlook-uppositivemobilebundlingwaapiString.prototype.trimString.prototype.matchAllviewdeterministicshebangESvalidspringrm -frECMAScript 2021schemagetOwnPropertyDescriptordeepcopyexitinstallObject.assignvaluesescapesigtermtestclassespropiterateclass-validatortapposelinkenumerablefind-uptranspilerpatchdateObject.entriesdeepclonesafelengthexpressdiffpromisegetintrinsicjestgenericses2015hasOwnECMAScript 2018babelmodulesisConcatSpreadableawaitfast-clonecall-bindstableES2018throttleshamrobustinternalqueueMicrotasksequenceless mixinscolorsRxcurriedcomparees-shim APIvalidationcomputed-typeskeysdeeputility.envgetPrototypeOfsuperagentArray.prototype.flatMapgroupByintrinsicsymbolsanimationcryptoautoprefixerObject.isInt32ArrayparentdescriptorpackagestrimLeftmapsymlinkswraplinewrapdatastructurewatcherfastcopyqueuescheme-validationsignalsrangeerrorsidenativewalkingreadablebootstrap cssES5es5css lessTypedArrayduplexgettermakeeslintcolumnsmatchescallboundvarauthenticationdebugtypanionstringifier[[Prototype]]lazyharmonycolorassertmatchAllflagsMapflattenmime-dbquerystringprocesseast-asian-widthFloat64ArrayStreamdirectorytapelibphonenumberiterationAsyncIteratorArrayBuffer#sliceinterruptsfantasy-landless cssvalidateObjectavalanguageReactiveExtensionspushframerassertsbusyloggingdescriptorssharedarraybuffercjk$.extendpolyfilleveryspeedYAMLxhrefficientjQueryclassnamefilepropertyunicodeaccessorframeworkObservablebytetypescriptregexvalidatorreact posecryptmruconfigurablequotespinnerUnderscoreless compilererror-handlingcss nestingarktypegesturesECMAScript 2015envArrayBuffer.prototype.slicestyled-componentsesthroatwatchingSymbol.toStringTagmetadatahookformreact animationecmascriptweakmapzerointernal slotquerycommandstringifyoperating-systemtimeArrayshrinkwrapjasmineArray.prototype.includesdependenciesrequestpicomatchenvironmentzodnegative zeroWeakSetcallbindES2017nested cssclientreduxObject.fromEntriesyup
1.0.0

15 days ago