Created
December 6, 2019 08:11
-
-
Save superRaytin/711c453ce98f6cda8a5b5b8dd27f7f62 to your computer and use it in GitHub Desktop.
replace specified content with some else string
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/sh | |
# replace name of html entry with fixed "index.html" in cmd file | |
targetCmdPath="${PWD}/{{ slug }}.sketchplugin/Contents/Sketch/my-command.js" | |
sed -i -r -E "s/(_webpack_resources\/).+(\.html)/\1index\2/" "$targetCmdPath" | |
# copy index.html to _webpack_resources | |
htmlPath="${PWD}/src/dist/index.html" | |
webpackResourcePath="${PWD}/{{ slug }}.sketchplugin/Contents/Resources/_webpack_resources" | |
/bin/cp -f "$htmlPath" "$webpackResourcePath" | |
# remove the backup file which is auto created by sed | |
targetBackupCmdPath="${PWD}/{{ slug }}.sketchplugin/Contents/Sketch/my-command.js-r" | |
rm "$targetBackupCmdPath" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment