Skip to content

Instantly share code, notes, and snippets.

@dev-juyoung
Created April 30, 2021 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dev-juyoung/ef44820e4fcef87764fc73e8bf867609 to your computer and use it in GitHub Desktop.
Save dev-juyoung/ef44820e4fcef87764fc73e8bf867609 to your computer and use it in GitHub Desktop.
Using zeplin's ios project, move the image file according to flutter's resource structure.
#!/usr/bin/env bash
scale2="@2x.png"
scale3="@3x.png"
for name in *.png; do
if [[ $name =~ $scale2 ]]; then
rename=$(echo $name | sed 's/\@2x.png$/.png/')
mv $name "$1/2.0x/$rename" && echo "moved $name -> $1/2.0x/$rename"
# t=$(echo $name | sed 's/\@2x.png$/.png/');
elif [[ $name =~ $scale3 ]]; then
rename=$(echo $name | sed 's/\@3x.png$/.png/')
mv $name "$1/3.0x/$rename" && echo "moved $name -> $1/3.0x/$rename"
else
mv $name "$1/$name" && echo "moved $name -> $1/$name"
fi
done
echo "\ncompleted."
@dev-juyoung
Copy link
Author

Go to the path where the image downloaded from zeplin is located and execute the following command.

  • sh {shell-file-storage-path/filename.sh} {project-path/assets-storage-path}

[Sample command]

  • sh ~/dev/tools/move-assets.sh ~/dev/project-name/assets/images

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment