Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Copy/Symlink missing, wrongly compiled, broken files in static content area after static content compilation of Magento 2
#!/bin/bash
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
MAGE2ROOT="/var/data/www/magento"
## Copy/Symlink missing/broken files for JS BUNDLING / MINIFICATION mode since it does not always work as expected, or some extensions do not support it
## Cycle through frontend themes and locales locales
front_theme_vendor=( Devdesco ) # Array of frontend theme vendors compiled
front_theme=( endohaus corporate ndtblog marketplace ) # Array of frontend themes compiled under all theme vendors combined
front_locales=( en_US fr_FR de_DE pt_BR es_AR it_IT ) # Array of all Frontend Locales compiled under all themes combined
for vendor_now in "${front_theme_vendor[@]}"
do
for theme_now in "${front_theme[@]}"
do
for locale_now in "${front_locales[@]}"
do
# Replace broken i18n.js with original one
cp -fvs $MAGE2ROOT/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/i18n.js $MAGE2ROOT/pub/static/frontend/$vendor_now/$theme_now/$locale_now/Magento_Ui/js/lib/knockout/bindings/i18n.js
done
done
done
# Cycle through adminhtml themes and locales locales
adminhtml_theme_vendor=( Magento Devdesco ) # Array of adminhtml theme vendors compiled
adminhtml_theme=( backend ) # Array of adminhtml themes compiled under all theme vendors combined
adminhtml_locales=( en_US ru_RU ) # Array of all adminhtml Locales compiled under all themes combined
for vendor_now in "${adminhtml_theme_vendor[@]}"
do
for theme_now in "${adminhtml_theme[@]}"
do
for locale_now in "${adminhtml_locales[@]}"
do
# Replace broken i18n.js with original one
cp -fvs $MAGE2ROOT/app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/i18n.js $MAGE2ROOT/pub/static/adminhtml/$vendor_now/$theme_now/$locale_now/Magento_Ui/js/lib/knockout/bindings/i18n.js
done
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.