Open soullivaneuh opened 3 years ago
Note: This also produces the /usr/bin/jq: Argument list too long
error on my setup script.
Related script part:
echo "Theme update."
templates=""
for template_path in templates/**/*; do
template_section=$(echo "${template_path}" | cut -d '/' -f 2)
field_name="${template_section}$(basename "$template_path" |
cut -d . -f1 |
awk 'BEGIN{FS="";RS="-";ORS=""} {$0=toupper(substr($0,1,1)) substr($0,2)} 1')
"
field_layout=$(jq -aRs . <(cat "$template_path"))
templates="${templates} | .templates.${field_name} = ${field_layout}"
done
ftl_helpers=$(jq -aRs . <(cat templates/_helpers.ftl))
ftl_index=$(jq -aRs . <(cat templates/index.ftl))
messages=$(jq -aRs . <(cat locales/messages.properties))
messages_fr=$(jq -aRs . <(cat locales/messages_fr.properties))
jq ".templates.helpers = ${ftl_helpers} | .templates.index = ${ftl_index} ${templates} | .defaultMessages = ${messages} | .localizedMessages.fr = ${messages_fr}" \
theme.json >generated.json
http --check-status --ignore-stdin PATCH "${host_app}"/api/theme/"${theme_id}" \
"${header_auth}" "${header_json}" \
theme:=@generated.json
Templates: Move the idendity providers onto separated file(s)
Description
Currently, all the social login button definition and logic are defined in the
_helpers.ftl
file.Because of that, the file is enormous with more than 65k chars:
Also, the override process is cumbersome. For my case, I override the helpers file just to change some meta and global design. I don't touch the social login button, but I always have to update this file to make the app working properly.
Plus, this looks a bit anti-pattern to manage special cases (social login button) on a centralized file, I am right? :thinking:
Solution
I see two solution:
What do you think?