2024-10-23 16:04:35 -04:00
|
|
|
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)}`;
|
|
|
|
}
|
2024-10-23 16:44:17 -04:00
|
|
|
if (bundle.type === 'woff2') {
|
|
|
|
let filePath = bundle.getMainEntry().filePath;
|
|
|
|
return `fonts/${path.basename(filePath)}`;
|
|
|
|
}
|
2024-10-23 16:04:35 -04:00
|
|
|
|
|
|
|
// Allow the next namer to handle this bundle.
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
});
|