elringus / imgit

Transform images, video and YouTube links to HTML optimized for web vitals

Home Page:https://imgit.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image Paths

zellwk opened this issue · comments

Imgit with Astro fetches the file from the public directory. But there are many instances where I want to fetch images from the /src/assets directory instead (since I use Astro's image optimization tool as well). Is it possible to remove the /public?

Example 
// Passed in value 
const test = await import('imgit:/asset/image.png') 

// Path used now
// /absolute-path-to-project/public/src/asset/image.png

// Preferred path 
// /absolute-path-to-project/src/asset/image.png

Sure, you can set the preferred root directory in the options:

export type Options = {
/** Local directory under which project's static files are stored. Required to resolve
* file paths of relative content sources; `./public` by default. */
root: string;

This issue is stale because it has been open 14 days with no activity. It will be automatically closed in 7 days.