Created
January 25, 2018 11:44
-
-
Save andreilupu/07e21a2e74c7ccf7850a2d64f8e90221 to your computer and use it in GitHub Desktop.
A fast bash script to replace all the 'textdomain' strings, from vendor, with the ones provided in `package.json`
This file contains 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 | |
#get the textdomain from the package.json file. | |
#export TEXTDOMAIN | |
TEXTDOMAIN=$(node -pe "require('./package.json').textdomain") | |
# if there is a textdomain, apply to the vendor folder. | |
if [ "$TEXTDOMAIN" != "undefined" ]; then | |
find "vendor" -type f -name "**.php" -exec sed -i "s/, 'textdomain' )/, '$TEXTDOMAIN' )/g" {} + | |
fi; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment