UNPKG

@trailstash/ultra

Version:

A web based tool for making MapLibre GL maps with data from sources such as Overpass, GeoJSON, GPX, KML, TCX, etc

33 lines (29 loc) 773 B
import fs from "fs"; import emoji from "emoji-datasource-google/emoji.json" with { type: "json" }; for (const [size, name] of [ [32, "emoji"], [64, "emoji@2x"], ]) { const spriteJSON = {}; for (const { sheet_x, sheet_y, short_names, image } of emoji) { const x = sheet_x * (size + 2) + 1; const y = sheet_y * (size + 2) + 1; for (const shortName of short_names) { spriteJSON[shortName] = { height: size, pixelRatio: size / 32, width: size, x, y, }; } } fs.writeFileSync( `static/sprites/${name}.json`, JSON.stringify(spriteJSON, null, 2), ); fs.copyFileSync( `node_modules/emoji-datasource-google/img/google/sheets-256/${size}.png`, `static/sprites/${name}.png`, ); }