miaam-assets
Version:
29 lines (20 loc) • 489 B
JavaScript
import { resolvePath } from '../../../../utils/index.js';
class Loader {
options;
constructor({ options }) {
this.options = options;
}
add() {}
pre() {}
use(resource, next) {
const resourcePath = resource.url;
if (!this.test(resourcePath)) return next();
const tileSet = resource.data;
tileSet.image = resolvePath(undefined, resourcePath, tileSet.image);
return next();
}
test(fileName) {
return /\.(tileset).json/.test(fileName);
}
}
export default Loader;