Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
It's a compact solution for SVG sprites in Astro. It bundles SVGs into one file, includes built-in components for easy use, and supports handleHotUpdate for smooth development.
This package is compatible with astro@3.0.0 and above and only supports the latest Integrations API.
Get started quickly with the help of the astro add
command tool
$ npx astro add astro-svgs
$ npm install astro-svgs
astro.config.*
file using the integrations property:// @ts-check
import { defineConfig } from "astro/config";
import svgs from "astro-svgs";
export default defineConfig({
integrations: [svgs()],
});
sprite.svg
to the default src/svgs
folder/
├── src/
│ ├── svgs/
│ │ ├── a.svg
│ │ ├── b.svg
│ │ └── c.svg
│ └── pages/
│ └── index.astro
└── package.json
Icon.astro
---
import Layout from '~/Layouts/Layout.astro';
import Icon from 'astro-svgs/Icon.astro';
---
<Layout>
{/* name is the `file name` of the icon you need*/}
<Icon name={"a"} class="<CustomClassName>" />
</Layout>
If everything goes well, when you start the server with
npm run dev
, you will be able to get the virtualsprite.svg
content throughhttp://localhost:4321/@svgs/sprite.svg
, which supports hot updates throughhandleHotUpdate
// @ts-check
import { defineConfig } from "astro/config";
import svgs from "astro-svgs";
export default defineConfig({
integrations: [
svgs({
/**
* The folder where the svg files that
* need to generate `sprite.svg` are located
*/
input: ["src/assets/sprites", "src/assets/images"]
/**
* default value
*/
compress: "high"
})
],
});
Wait, how do you control the output? It will be automatically generated in the AstroConfig.build.assets
directory when you build via vite, for example _astro/sprite.43a97aac.svg
Submit your issues or feedback on our GitHub channel.
MIT
FAQs
A compact solution for SVG sprites in Astro projects. It automates symbol ID management, supports hot reloading, and generates optimized SVG sprites with minimal setup—ideal for seamless SVG icon integration.
The npm package astro-svgs receives a total of 256 weekly downloads. As such, astro-svgs popularity was classified as not popular.
We found that astro-svgs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.