Skip to content

Instantly share code, notes, and snippets.

@artistro08
Created June 17, 2022 21:18
Show Gist options
  • Save artistro08/0fcd3f163bc812d27b289fc2d6fd1528 to your computer and use it in GitHub Desktop.
Save artistro08/0fcd3f163bc812d27b289fc2d6fd1528 to your computer and use it in GitHub Desktop.
Create JSON Import file from icons. Used for Tailor Entries in OctoberCMS
#!/bin/bash
#
# Bash file to create json output of Bootstrap Icons.
# Used for Tailor, an OctoberCMS Feature
# Requires jq: https://stedolan.github.io/jq
#
index=0
for file in $(ls *.svg);
do
index=$(($index+1))
file_version=$(basename $file .svg);
svg_code=$(cat $file)
jq -n --arg name "$file_version" --arg index "$index" --arg svg_code "$svg_code" '{id: $index, is_enabled: 1, title: $name, svg_code: $svg_code }';
done | jq -n '. |= [inputs]' > bootstrap-icons.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment