-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(gatsby-plugin-typography): sort typography style tag first to avoid overwriting issues #12295
Conversation
…t the top of the <head> so they don't overwrite other styles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Successfully published |
🎉 |
woohoo, glad to see this make it in! Thanks! |
I am still seeing some things inlined differently. I can reproduce it in the examples on the theme I have thrown together. Particularly noticeable with the Links being light green vs blue on the /articles/ page. |
I've come across the same issue today. So I've fixed it by overriding // override method before exporting typography
typography.injectStyles = function() {
if (typeof document !== 'undefined') {
// Replace existing
const styleNode = document.getElementById('typography.js');
if (styleNode !== null) {
styleNode.innerHTML = this.toString();
} else {
const node = document.createElement('style');
node.id = 'typography.js';
// note: use typography context
node.innerHTML = typography.toString();
// note here: I use prepend, not appendChild
document.head.prepend(node);
}
}
}; |
@jbolda @krizzu I assume this is development? @DSchau has a PR open for the same change as @krizzu at KyleAMathews/typography.js#201 |
@KyleAMathews yep, thanks for the heads up! |
@jbolda any interest in validating the changes in that PR with your repo? You can just build out and copy over files, or use Would help us assert that it's actually the fix--although it seems pretty obvious that is the fix! |
@DSchau's PR with the |
Now that Ejecting |
This PR also pushes |
@robert-claypool the expectation is that you'd use the normalize.css file Typography.js includes. Is there something special about your reset? Perhaps we could add support for custom resets to Typography.js. The assumption is that Typography.js is your reset — so you wouldn't need anything more than that. The second issue should definitely be fixed. Would you like to give it a go at fixing it? You'd need to edit the sort so that it puts gatsby/packages/gatsby-plugin-typography/src/gatsby-ssr.js Lines 26 to 32 in 632f035
|
Fixes #12295
Fixes #6302
Fixes #9911
Fixes #1994