journal-homepage/image_namer.mjs
Isaac Mills 4f247de35b
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Switch font to consistent location
2024-10-23 14:44:17 -06:00

18 lines
546 B
JavaScript

import {Namer} from '@parcel/plugin';
import path from 'path';
export default new Namer({
name({bundle}) {
if (bundle.type === 'png' || bundle.type === 'jpg' || bundle.type == 'svg' || bundle.type === 'ico') {
let filePath = bundle.getMainEntry().filePath;
return `images/${path.basename(filePath)}`;
}
if (bundle.type === 'woff2') {
let filePath = bundle.getMainEntry().filePath;
return `fonts/${path.basename(filePath)}`;
}
// Allow the next namer to handle this bundle.
return null;
}
});