Skip to content

How can I add global styles into the cms? (NextJS) #6465

Unanswered
danielmoessner asked this question in Q&A
How can I add global styles into the cms? (NextJS) #6465
May 7, 2022 · 0 answers

I'm starting the cms manually like this from pages/admin.tsx:

import dynamic from "next/dynamic";
import config from "../cms/config";
// import "../styles/globals.css";  <-- Does not work because NextJS complains that this is only allowed in _app.tsx

const Component = dynamic(
  () => {
    return import("netlify-cms-app").then((cms) => {
      cms.init({ config });
    });
  },
  { ssr: false, loading: () => <p>Loading...</p> }
);

const AdminPage: React.FC = () => {
  return <Component />;
};

export default AdminPage;

My Admin pages use the preview feature of NetlifyCMS, but I can't get the global styles imported. Is there any solution to importing styles into the CMS?

Replies

0 suggested answers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant