![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
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.
A compact, flexible solution for managing SVG sprites in Astro projects.
It automates symbol ID management, supports hot reloading, and generates optimized SVG sprites with minimal setup. It includes built-in components and an open API, allowing easy customization to suit your needs.
Quickly install with the astro add
command:
npx astro add astro-svgs
If you run into issues, try with Manual Setup guide.
Step 1: To install manually, run:
npm install astro-svgs
Step 2: Add the integration to your Astro config file (astro.config.*
):
// @ts-check
import { defineConfig } from "astro/config";
import svgs from "astro-svgs";
export default defineConfig({
integrations: [svgs()],
});
Step 3: Place your SVG files in the default src/svgs
folder:
/
├── src/
│ ├── pages/
│ │ └── index.astro
│ └── svgs/
│ ├── a.svg
│ ├── b.svg
│ └── *.svg
└── astro.config.mjs
Step 4: Use the built-in Icon.astro
component to render icons from the sprite:
---
import Layout from '~/Layouts/Layout.astro';
import { Icon } from 'astro-svgs/Icon.astro';
---
<Layout>
{/* Type hints and checks are provided by `.astro/integrations/astro-svgs/types.d.ts`. */}
<Icon name="a" class="<CustomClassName>" />
</Layout>
Start the server with npm run dev
, then access the virtual sprite.svg
at http://localhost:4321/@svgs/sprite.svg
.
Full configuration reference
// @ts-check
import { defineConfig } from "astro/config";
import svgs from "astro-svgs";
export default defineConfig({
build: {
assets: "_astro",
assetsPrefix: env.SITE_URL,
},
integrations: [
svgs({
/**
* Folder paths containing SVG files to generate `sprite.svg`
* @default "src/svgs"
*/
input: ["src/assets/sprites", "src/assets/icons"],
/**
* @default
* isDev ? "beatfify" : "high"
*/
compress: "beautify",
}),
],
});
Output: The sprite file will automatically be built in
config.build.assets
during the build process (e.g.,_astro/sprite.43a97aac.svg
).
file
type: string
the sprite.svg file path.
SymbolId
type: Union Type
The svg file unique name you should use.
src/components/Icon.astro
Creating a simple custom Icon.astro
using the component API.
---
import { file, type SymbolId } from 'virtual:astro-svgs';
export interface Props {
name: SymbolId;
}
const { name } = Astro.props;
---
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
<use xlink:href={`${file}#${name}`} xmlns:xlink="http://www.w3.org/1999/xlink" />
</svg>
The virtual module definition is automatically generated when the server starts with
npm run dev
and is located at.astro/integrations/astro-svgs/types.d.ts
.
If you have questions or feedback, feel free to submit an issue on our GitHub repository.
For the full changelog, see the Releases page.
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 14 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 0 open source maintainers 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
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.