Created
June 17, 2022 21:18
-
-
Save artistro08/0fcd3f163bc812d27b289fc2d6fd1528 to your computer and use it in GitHub Desktop.
Create JSON Import file from icons. Used for Tailor Entries in OctoberCMS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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