-
Notifications
You must be signed in to change notification settings - Fork 20
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
@elderjs/plugin-images - Deleting image from source folder not reflected in generated files #30
Comments
Ok. As a result of fixing this issue github.com/Elderjs/plugins/issues/31 only the image sizes from plugin configuration will be copied over to public folder during the build, so it in principle fixes this issue as well. Image cache itself is persistent and all the sizes once generated will stay there and this is probably for performance reasons. Some notes: Added these lines to .gitignore to keep cache files out of repository
Cleaning cacheAdded explicitly default cache related values to elder.config.js imageManifest: '/images/ejs-image-manifest.json',
cacheFolder: '/images/sizes/', and created package script to clear the cache when it feels appropriate //src/cleanImageCache.js
const del = require('del');
const path = require('path');
const { getConfig } = require('@elderjs/elderjs');
a
const { rootDir, plugins } = getConfig();
console.log(' Clearing out image cache.');
if (plugins['elderjs-plugin-images'] !== undefined) {
const plugin = plugins['@elderjs/plugin-images'];
if (plugin.imageManifest !== undefined) {
del.sync(path.join(rootDir, plugin.imageManifest));
}
if (plugin.cacheFolder !== undefined) {
del.sync(path.join(rootDir, plugin.cacheFolder));
}
} node ./src/cleanImageCache.js |
@meigo We should add a check that update the manifest but for now, just delete it and the plugin will rebuild it without recreating the images. I've added your scripts above to the readme. |
Thanks. //src/cleanImageCache.js
const del = require('del');
const path = require('path');
const { getConfig } = require('@elderjs/elderjs');
const { rootDir, plugins } = getConfig();
console.log(' Clearing out image cache.');
if (plugins['@elderjs/plugin-images'] !== undefined) {
const plugin = plugins['@elderjs/plugin-images'];
if (plugin.imageManifest !== undefined) {
del.sync(path.join(rootDir, plugin.imageManifest));
}
if (plugin.cacheFolder !== undefined) {
del.sync(path.join(rootDir, plugin.cacheFolder));
}
} |
@meigo Thanks! |
Deleting (or renaming) image files from source folder doesn't remove related generated images and entries from ejs-image-manifest.json. Is this intended behaviour?
The text was updated successfully, but these errors were encountered: