mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-14 09:39:15 +00:00
Introduce libSquoosh
This commit is contained in:
12
libsquoosh/lib/autojson-plugin.js
Normal file
12
libsquoosh/lib/autojson-plugin.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import { promises as fsp } from 'fs';
|
||||
|
||||
export default function autojsonPlugin() {
|
||||
return {
|
||||
name: 'autojson-plugin',
|
||||
async load(id) {
|
||||
if (id.endsWith('.json') && !id.startsWith('json:')) {
|
||||
return 'export default ' + (await fsp.readFile(id, 'utf8'));
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user