Comments (5)
The best place for it is probably your layout file, the one you use for wrapping every page. That way those styles will be included in all pages. You might not even need to assign it to a variable, because I don't know what you would do with it, try to just run:
css`
:global() {
/* ... */
}
`
but I'm not 100% sure about that. The point is that it has to reside in the file which actually runs. Where did you put it?
from gatsby-plugin-linaria.
For me adding it to a page works as well, this is my src/pages/index.js
:
import React from 'react'
import { css } from 'linaria'
css`
:global() {
html {
background: black;
color: #fff;
}
}
`
const Home = () => <h1>Hello World!</h1>
export default Home
I hope you'll figure it out.
from gatsby-plugin-linaria.
It works for me, please provide steps to reproduce (or better yet, a repo).
Btw, I'm not sure why their example contains export
, since it doesn't have any context.
from gatsby-plugin-linaria.
@silvenon thank you for a quick reply! In your working example, where do you use this globals
variable? From the docs, I understood that you just need to export in one of the files accessible by Gatbsy (similar to how fragments work) and it should be enough, but maybe I'm wrong
from gatsby-plugin-linaria.
Thank you so much for you help, it actually does work! Originally, I was trying to include it in a file inside pages
folder, which didn't work for some reason, but when I imported it inside one of the components, it worked.
from gatsby-plugin-linaria.
Related Issues (20)
- Make CSS Extraction an option. HOT 1
- Setup renovate
- Setup E2E
- Unexpected token 'export' HOT 12
- Breaks Gatsby v3 HOT 1
- Temporary workaround
- Request to set option `cacheDirectory` HOT 2
- TypeError: filename.endsWith is not a function HOT 2
- npm install issue with Gatsby v4.x.x HOT 2
- Unexpected Runtime errors.
- File with extracted CSS styles not link to my output html
- Support for [email protected]? HOT 1
- Dependency Dashboard
- Plugin doesn't work
- Support Linaria v5 and v6
- Doesn't work with core-js v3 HOT 8
- Option to disable SSR? HOT 4
- Error: Using the "styled" tag in runtime is not supported HOT 3
- Why do we need linaria with gatsbyjs? HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby-plugin-linaria.