fix(client): inject bootstrap tags to the top of head (#40804)

This commit is contained in:
Ahmad Abdolsaheb
2021-01-27 16:47:01 +03:00
committed by Mrugesh Mohapatra
parent 9ec8aa3db4
commit 4879d26604
2 changed files with 18 additions and 2 deletions

View File

@ -32,3 +32,19 @@ export const onRenderBody = ({
setHeadComponents(getheadTagComponents());
setPostBodyComponents(getPostBodyComponents(pathname));
};
export const onPreRenderHTML = ({
getHeadComponents,
replaceHeadComponents
}) => {
const headComponents = getHeadComponents();
headComponents.sort((x, y) => {
if (x.key === 'bootstrap-min-preload' || x.key === 'bootstrap-min') {
return -1;
} else if (y.key === 'bootstrap-min-preload' || y.key === 'bootstrap-min') {
return 1;
}
return 0;
});
replaceHeadComponents(headComponents);
};