linaria icon indicating copy to clipboard operation
linaria copied to clipboard

Weird behaviour of global css when using linaria/loader

Open vlatkoodrljin opened this issue 5 years ago • 2 comments

I followed official nextjs linaria example:

https://github.com/vercel/next.js/blob/canary/examples/with-linaria

to setup basic app and tried to import simple global css:

global.css

body {
  margin: 0;
}

directly into _app.js.

_app.js

import Layout from '../components/Layout';
import '../global.css';

const App = props => {
  const { Component, pageProps } = props;
  return (
    <Layout>
      <Component {...pageProps} />
    </Layout>
  );
};

export default App;

CSS is added correctly to the top of the css file but when I inspect body tag using Chrome I see that global css styles are applied from the last component in the tree, does anybody know why? Am I doing something wrong?

vlatkoodrljin avatar Sep 15 '20 19:09 vlatkoodrljin

any progress on this issue?

theskillwithin avatar Feb 01 '22 22:02 theskillwithin

Did you see the new version of the Next.js Linaria example added in this PR here? https://github.com/vercel/next.js/pull/41085/files

There are also other solutions in https://github.com/callstack/linaria/issues/589

karlhorky avatar Oct 20 '22 13:10 karlhorky