-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclude original images from output dir #8143
Comments
What do you mean by "your cache folder"? Do you mean the build output or the cache folder in |
Hi @Princesseuh ! Yes, the cache folder in // astro.config.mjs
import { defineConfig, sharpImageService } from 'astro/config';
import react from '@astrojs/react';
import sitemap from '@astrojs/sitemap';
import mdx from '@astrojs/mdx';
/** @type {import('astro/config').AstroUserConfig} */
const config = {
site: 'https://pkolt.ru',
integrations: [react(), sitemap(), mdx()],
compressHTML: true,
markdown: {
gfm: true,
syntaxHighlight: 'prism',
},
outDir: 'out',
cacheDir: 'cache', // <---- CACHE FOLDER
experimental: {
assets: true,
},
image: {
service: sharpImageService(),
},
};
export default defineConfig(config); |
Hmm, we don't cache the original images, only the transformed versions, the goal is to avoid redoing the transforming step. Are you sure you're seeing the original files? |
Hi @Princesseuh ! Yes, you can see for yourself.
For example, I have a large image file (3.4Mb) - After executing the build command We can even compare both of these files by hash, they are the same file:
This is very bad, because the original images are very large, I would not want them to end up in the output directory. |
Ah, so not in the cache folder, in the output build. Yes this is a known "issue", though it's more of a design choice because people often like having features like "Click to see original", or maybe show the original as a fallback in the case of a picture element and it's not possible for us to statically know if you're using those original assets outside the optimization pipeline or not We could probably have an optional option to delete the original files if an optimized version exists, should be doable, though we'd have to carefully document the side effects it can cause |
Hello! I would like to express my strong desire for the inclusion of an optional feature that allows us to delete the original files from output folder. In my situation, I have 20,000 thumbnails alongside their original versions, and this is leading to significant storage consumption and longer deployment times. Thank you! |
Related to withastro#8143 Setting `assetsRemoveOriginals: true` will remove original images from `dist/_astro` folder
Related to withastro#8143 Setting `assetsRemoveOriginals: true` will remove original images from `dist/_astro` folder
Related to withastro#8143 Setting `assetsRemoveOriginals: true` will remove original images from `dist/_astro` folder
What version of
astro
are you using?2.10.9
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Mac
What browser are you using?
Chrome
Describe the Bug
Hi guys!
I'm using Astro with the assets module.
After executing the command -
astro build
, my cache folder contains image thumbnails.But the original images are also in the cache folder.
Is it possible to add some setting to adjust Astro to remove original images?
The original images weigh a lot and slow down the deployment process to github pages.
What's the expected result?
There are no original images in the cache folder.
Link to Minimal Reproducible Example
https://github.com/pkolt/pkolt.ru
Participation
The text was updated successfully, but these errors were encountered: