Closed willfarrell closed 2 years ago
Hi @willfarrell,
even if we would add the application/ld+json
to the allowed script mimetypes, it would not make a big difference.
Because in general this is not valid JavaScript but JSON and this library compresses HTML + JavaScript and CSS. But JSON is not JavaScript.
Terser has an option to parse just an expression:
--parse expression
This may minify the JSON.
Hi @mauriciabad,
I'm not sure how we can add this in html-minifier-terser. This would be a new feature as html-minifier-terser compresses only js, css and html but no other formats afaik.
PRs which add this are very welcome.
This may minify the JSON.
Does it minify it? I'm not sure if this compresses every available form of JSON. Would be good if someone can test and verify this so we can discuss possible solutions.
{ processScripts: ['application/ld+json'] }
Pass an option like this works for me.
For google datasets to work it requires Schema.org JSON-LD inline script tag on a page. Compression of this by default or behind a flag would be awesome.
Example