Skip to content

Commit

Permalink
feat(HMR): Fix HMR 🔨 (#459)
Browse files Browse the repository at this point in the history
* feat(HMR): Fix HMR 🔨

* chore(HMR): Add cli parameter to windows scripts

* deps(nodemon): Update nodemon

* fix(prettier): Pretty fix
  • Loading branch information
Jeevan-Kishore authored Nov 2, 2022
1 parent 968678f commit 1c6e977
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 487 deletions.
12 changes: 8 additions & 4 deletions app/server/handlers/render-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Footer } from "../../isomorphic/components/layouts/footer";
import fontFace from "../font";
import { BreakingNewsView } from "../../isomorphic/components/breaking-news-view";
import { TopAd } from "../../isomorphic/components/ads/top-ad";
import { getConfig, extractor, getCriticalCss, getArrowCss } from "../helpers";
import { getConfig, extractor, getCriticalCss, getArrowCss, getStyleTags } from "../helpers";
import get from "lodash.get";

const cssContent = assetPath("app.css") ? readAsset("app.css") : "";
Expand All @@ -26,11 +26,13 @@ export async function renderLayout(res, params) {
isGaEnable,
enableAds,
loadAdsSynchronously,
pageType
pageType,
} = getConfig(params.store.getState());
const chunk = params.shell ? null : allChunks[getChunkName(params.pageType)];
const criticalCss = await getCriticalCss();
const styleTags = await getStyleTags();
const arrowCss = await getArrowCss(params.store.getState());
const isProduction = process.env.NODE_ENV === "production";

const placeholderDelay = parseInt(
get(params.store.getState(), ["qt", "config", "publisher-attributes", "placeholder_delay"])
Expand All @@ -40,10 +42,12 @@ export async function renderLayout(res, params) {
"pages/layout",
Object.assign(
{
isProduction,
assetPath: assetPath,
content: params.content || "",
cssContent: cssContent,
criticalCss: criticalCss,
styleTags,
arrowCss,
fontJsContent: fontJsContent,
fontFace: fontFace,
Expand All @@ -55,7 +59,7 @@ export async function renderLayout(res, params) {
topad: renderReduxComponent(TopAd, params.store),
breakingNews: renderReduxComponent(BreakingNewsView, params.store, {
breakingNews: [],
breakingNewsLoaded: false
breakingNewsLoaded: false,
}),
disableAjaxNavigation: false,
gtmId,
Expand All @@ -74,7 +78,7 @@ export async function renderLayout(res, params) {
loadAdsSynchronously,
placeholderDelay,
pageType,
enableBreakingNews: params.pageType !== "profile-page"
enableBreakingNews: params.pageType !== "profile-page",
},
params
)
Expand Down
1 change: 1 addition & 0 deletions app/server/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,4 @@ export const getCriticalCss = async () => {
const criticalCss = await extractor.getCssString();
return criticalCss.trim();
};
export const getStyleTags = async () => extractor.getStyleTags();
Loading

0 comments on commit 1c6e977

Please sign in to comment.