Skip to content

added sync style method in next.config.js #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 28 additions & 13 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
// next config
module.exports = {
trailingSlash: true,
reactStrictMode: true,
eslint: {
ignoreDuringBuilds: true,
},
async redirects() {
// Dynamic module import because nextjs-sync is ESM
const zestyNext = await import("@zesty-io/nextjs-sync");
const data = await zestyNext.fetchRedirects();
return data;
},
async function getStyles() {
// Dynamic module import because nextjs-sync is ESM
const { styles } = await import("@zesty-io/webengine-json");
const data = await styles(
process.env.ZESTY_PREVIEW_DOMAIN,
process.env.ZESTY_PREVIEW_PASSWORD
);
return data;
}

module.exports = async () => {
return {
// passing sync styles
publicRuntimeConfig: {
styles: await getStyles(),
},
trailingSlash: true,
reactStrictMode: true,
eslint: {
ignoreDuringBuilds: true,
},
async redirects() {
// Dynamic module import because nextjs-sync is ESM
const zestyNext = await import("@zesty-io/nextjs-sync");
const data = await zestyNext.fetchRedirects();
return data;
},
};
};
3 changes: 3 additions & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { createTheme, ThemeProvider, CssBaseline } from '@mui/material';
import { Roboto } from 'next/font/google';
import type { AppProps } from 'next/app';
import { grey } from '@mui/material/colors';
var getConfig = require("next/config");
const { publicRuntimeConfig } = getConfig();
let styles = publicRuntimeConfig.styles;

const roboto = Roboto({
weight: ['300', '400', '500', '700'],
Expand Down