Skip to content

Instantly share code, notes, and snippets.

@andreilupu
Created January 25, 2018 11:44
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 andreilupu/07e21a2e74c7ccf7850a2d64f8e90221 to your computer and use it in GitHub Desktop.
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`
#!/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