Skip to content

Instantly share code, notes, and snippets.

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`
#get the textdomain from the package.json file.
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" {} +
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment