Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
@astropub/assist
Advanced tools
Astro Assist is a library of tools to help you develop with Astro.
Install Astro Assist to your project.
npm install @astropub/assist
Add Astro Assist to your Astro configuration.
// astro.config.js
import assist from '@astropub/assist'
/** @type {import('astro').AstroUserConfig} */
const config = {
vite: {
plugins: [
assist()
]
}
}
export default config
Enjoy!
The addAsset
method lets you add an asset to the project. The asset will be
available in develoment and automatically bundle during build.
Example:
---
// src/pages/kitten.astro
import * as assist from '@astropub/assist'
const kitten = assist.addAsset(Astro.resolve('kitten.jpg'))
---
<img src={kitten} alt="kitten" />
Example in a Component:
---
// src/components/Image.astro
import * as assist from '@astropub/assist'
const src = assist.addAsset(Astro.resolve(Astro.props.src))
---
<img {...Astro.props} {src} />
The process
method lets you modify an asset that is added to the project.
The modified asset will be cached to avoid any repetitive expensive processing.
The process
method provides the asset source as a Buffer
and the asset
details as an Object
and returns a new Buffer
.
Example:
// astro.config.js
import assist from '@astropub/assist'
/** @type {import('astro').AstroUserConfig} */
const config = {
vite: {
plugins: [
assist({
async process(buffer, asset) {
return await doSomethingWith(buffer)
}
})
]
}
}
export default config
Example in a Component:
---
import * as assist from '@astropub/assist'
const src = assist.addAsset(Astro.resolve(Astro.props.src), {
async process(buffer, asset) {
return await doSomethingWithTheImage(buffer)
}
})
---
<img {...Astro.props} {src} />
FAQs
A library of tools to help you develop with Astro
We found that @astropub/assist demonstrated a not healthy version release cadence and project activity because the last version was released 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
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.