-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bee6697
commit 50a2436
Showing
6 changed files
with
86 additions
and
14 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
# @Author: Roni Laukkarinen | ||
# @Date: 2022-08-18 13:02:37 | ||
# @Last Modified by: Roni Laukkarinen | ||
# @Last Modified time: 2022-08-18 13:10:23 | ||
|
||
# // New files/Dependencies (this file will install them): | ||
# // ├── sass/gutenberg/blocks/_hero-big-image.scss (automatic from get-block.sh) | ||
# // ├── sass/components/_content-box.scss | ||
# // └── svg/block-icons/hero-big-image.svg | ||
|
||
# // Changes to files/folders: | ||
# // ├── sass/components/_components.scss | ||
# // ├── sass/gutenberg/_blocks.scss | ||
# // ├── acf-json/ | ||
# // └── functions.php | ||
|
||
# Block specific variables | ||
export BLOCK_ACF_JSON_FILE="group_62022454b648d.json" | ||
export BLOCK_ACF_JSON_PATH="${AIRBLOCKS_THEME_PATH}/acf-json/${BLOCK_ACF_JSON_FILE}" | ||
|
||
# Style component dependencies | ||
cp -nv ${AIRBLOCKS_THEME_PATH}/sass/components/_content-box.scss ${PROJECT_THEME_PATH}/sass/components/ | ||
|
||
# Import components right after the last default component in the _components.scss file | ||
sed -e "/\@import \'link\'\;/a\\ | ||
@import 'content-box';" < ${PROJECT_THEME_PATH}/sass/components/_components.scss > ${PROJECT_THEME_PATH}/sass/components/_components_with_changes.scss | ||
rm ${PROJECT_THEME_PATH}/sass/components/_components.scss | ||
mv ${PROJECT_THEME_PATH}/sass/components/_components_with_changes.scss ${PROJECT_THEME_PATH}/sass/components/_components.scss | ||
|
||
# Register ACF block in functions.php | ||
# Please note: The title of the block will be translated in localization.sh if en is selected | ||
sed -e "/\'acf_blocks\' \=\> \[/a\\ | ||
[|\ | ||
'name' => 'hero-big-image',|\ | ||
'title' => 'Sivun yläosa isolla taustakuvalla',|\ | ||
],\\" < ${PROJECT_THEME_PATH}/functions.php | tr '|' '\n' > ${PROJECT_THEME_PATH}/tmpfile |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
echo "${YELLOW}Renaming block to '${BLOCK_NAME_TO_RENAME_TO}'...${TXTRESET}" | ||
mv ${PROJECT_THEME_PATH}/template-parts/blocks/${BLOCK_NAME}.php ${PROJECT_THEME_PATH}/template-parts/blocks/${BLOCK_NAME_TO_RENAME_TO}.php | ||
mv ${PROJECT_THEME_PATH}/sass/gutenberg/blocks/_${BLOCK_NAME}.scss ${PROJECT_THEME_PATH}/sass/gutenberg/blocks/_${BLOCK_NAME_TO_RENAME_TO}.scss | ||
mv ${PROJECT_THEME_PATH}/svg/block-icons/${BLOCK_NAME}.svg ${PROJECT_THEME_PATH}/svg/block-icons/${BLOCK_NAME_TO_RENAME_TO}.svg | ||
|
||
# Renaming block names in files | ||
sed -i '' -e "s;${BLOCK_NAME};${BLOCK_NAME_TO_RENAME_TO};" ${PROJECT_THEME_PATH}/sass/gutenberg/_blocks.scss | ||
sed -i '' -e "s;${BLOCK_NAME};${BLOCK_NAME_TO_RENAME_TO};" ${PROJECT_THEME_PATH}/functions.php | ||
|
||
# Renaming block UI label | ||
sed -i '' -e "s/'title' \=\> '.*',/'title' \=\> '${BLOCK_UI_TITLE_TO_RENAME_TO}',/" ${PROJECT_THEME_PATH}/functions.php | ||
|
||
# Renaming block UI name in ACF | ||
if [[ ${AIR_BLOCKS_LANG} = "fi" ]]; then | ||
sed -i '' -e "s/\"title\"\: \"Lohko\: .*\"\,/\"title\"\: \"Lohko\: ${BLOCK_UI_TITLE_TO_RENAME_TO}\"\,/" ${PROJECT_THEME_PATH}/acf-json/${BLOCK_ACF_JSON_FILE} | ||
else | ||
sed -i '' -e "s/\"title\"\: \"Block\: .*\"\,/\"title\"\: \"Block\: ${BLOCK_UI_TITLE_TO_RENAME_TO}\"\,/" ${PROJECT_THEME_PATH}/acf-json/${BLOCK_ACF_JSON_FILE} | ||
fi |
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