Skip to content

Instantly share code, notes, and snippets.

@Awea Awea/asset_list.bash
Created Mar 23, 2018

What would you like to do?
Snippet: output list of assets to an assets.json file for batch loading
# Script used in combinaison with
# Assign find result to an array see:
while IFS= read -r -d $'\0'; do
# Remove static/ from asset path
# Find with multiple exclude see:
# Ignore file starting with static/fonts and .* files
done < <(find static \( -path static/fonts -o -name ".*" \) -prune -o -type f -print0)
# Format an array to json see:
printf '%s\n' "${assets[@]}" | jq -R . | jq -s . > src/json/assets.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.