Created
August 9, 2021 03:15
-
-
Save c9n/0a6f29485cd9de0828d274ce3d24974d to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# Created by LYNN | |
# At 2018-07-06 09:24:56 | |
# | |
# Usage: | |
# px2rpx.sh { path } | |
# | |
# Example: | |
# cd { project root path } | |
# tools/px2rpx.sh by_mini/pages/address | |
echo "[ working directory ] => `pwd`" | |
if [ $# -eq 0 ]; then | |
echo "NO TARGET" | |
exit | |
else | |
target=$1 | |
fi | |
if [ ! -d "$target" ]; then | |
echo "[E] 目标文件夹不存在 => $target"; | |
exit | |
fi | |
find $target -name "*.wxss" -print0 | while read -d $'\0' file | |
do | |
echo "[ processing ] => $file" | |
perl -i -pe 's/(\d+)(px)/($1*2).(rpx)/ge' $file | |
done | |
echo "[ Done √ ]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment