Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A fast bash script to replace all the 'textdomain' strings, from vendor, with the ones provided in `package.json`
#!/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