package.build.rollup_plugin_minify_style_spec.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mapbox-gl Show documentation
Show all versions of mapbox-gl Show documentation
A WebGL interactive maps library
The newest version!
function replacer(k, v) {
return (k === 'doc' || k === 'example' || k === 'sdk-support') ? undefined : v;
}
export default function minifyStyleSpec() {
return {
name: 'minify-style-spec',
transform: (source, id) => {
if (!/style\-spec[\\/]reference[\\/]v[0-9]+\.json$/.test(id)) {
return;
}
const spec = JSON.parse(source);
delete spec['expression_name'];
return {
code: JSON.stringify(spec, replacer, 0),
map: {mappings: ''}
};
}
};
}