Feature Use Case
When emiting files during a build, it would be great if we can have a hook for transforming those files. This way we can separate plugins which emit/copy files and plugins which transform those files.
Feature Proposal
Add a transformFile hook similar to transform.
export default {
plugins: [
{
transformAsset(content, id) {
if (id.endsWith('.json') {
// minify JSON
return JSON.stringify(JSON.parse(content));
} else if (id.endsWith('.png') {
return minifyImage(content);
}
}
}
]
}
Feature Use Case
When emiting files during a build, it would be great if we can have a hook for transforming those files. This way we can separate plugins which emit/copy files and plugins which transform those files.
Feature Proposal
Add a
transformFilehook similar totransform.