Skip to content

Instantly share code, notes, and snippets.

View lukaskoeller's full-sized avatar
🤙

Lukas Koeller lukaskoeller

🤙
View GitHub Profile
@lukaskoeller
lukaskoeller / index.js
Last active January 25, 2023 14:32
Build image map making use of vite-imagetools
const fs = require('fs');
const path = require('path');
const directoryPath = './src/assets/images';
const outputPath = './src/assets/images/index.ts';
const imageExtensions = ['png', 'jpg', 'jpeg', 'gif'];
const CONSULTANT_IMPORT_SET = [];
const CONSULTANT_IMG_MAP = [];
@lukaskoeller
lukaskoeller / index.js
Last active April 6, 2022 08:43
Creates a map of all icons within a directory and puts them in a single file with consisting naming
#!/usr/bin/env node
// Icon Map Build Script
const { readdirSync, writeFileSync } = require('fs');
const ICON_SOURCE_FOLDER = './';
const ICON_MAP_FILE_DEST_FOLDER = './iconUrlMap.ts';
// Prefix to escape syntax error by icon names that start with a digit or equal "react".
const prefix = 'svg';