-
It seems the recommended way of adjusting font sizes is overriding I was thinking maybe extract the relevant lines to their own CSS, or somehow expose the font sizes as variables (without overriding all of |
Beta Was this translation helpful? Give feedback.
Replies: 22 comments 3 replies
-
The way Jekyll handles There's actually a simpler solution. Because of the way CSS works, you can add all of your custom overrides or "new" CSS to a single file, This file has 2 lines, and the chances of it changing are slim to none since all it does is import another Sass partial that contains all of the theme's components and modules. So what you can do is add any overriding/new CSS after the @import "minimal-mistakes";
html {
font-size: 16px; // change to whatever
@include breakpoint($medium) {
font-size: 18px; // change to whatever
}
@include breakpoint($large) {
font-size: 20px; // change to whatever
}
@include breakpoint($x-large) {
font-size: 22px; // change to whatever
}
} These will cascade and override the font-sizes declared earlier in the CSS. |
Beta Was this translation helpful? Give feedback.
-
Great stuff. BTW what is the difference between this and |
Beta Was this translation helpful? Give feedback.
-
Setting a font-size in pixels on the base The For example when the screen size is less than |
Beta Was this translation helpful? Give feedback.
-
Ah, I see. So if one wants to make everything smaller categorically across the entire site, indeed it makes sense to alter the base pixel size as above, rather than change all the multipliers... |
Beta Was this translation helpful? Give feedback.
-
You got it. |
Beta Was this translation helpful? Give feedback.
-
@mmistakes Should this work on a Github Pages site using
Based on the structure page in your docs, I created an |
Beta Was this translation helpful? Give feedback.
-
@MV10 yes this should work. Your issue might be how styles are cascading and specificity depending on what you're trying to do . What does the content of your If you override any variables found in And if you're adding CSS to |
Beta Was this translation helpful? Give feedback.
-
Exactly as you demonstrated earlier but with different px sizes. ---
# Only the main Sass file needs front matter (the dashes are enough)
---
@charset "utf-8";
@import "minimal-mistakes/skins/{{ site.minimal_mistakes_skin | default: 'default' }}"; // skin
@import "minimal-mistakes"; // main partials
// https://github.com/mmistakes/minimal-mistakes/issues/1219#issuecomment-326809412
html {
font-size: 12px; // originally 16px
@include breakpoint($medium) {
font-size: 14px; // originally 18px
}
@include breakpoint($large) {
font-size: 16px; // originally 20px
}
@include breakpoint($x-large) {
font-size: 18px; // originally 22px
}
} |
Beta Was this translation helpful? Give feedback.
-
@MV10 I just tested this locally and it worked perfectly for me. The font sizes reduced in size. Looks to me like you have a caching issue. Is this happening locally or on GitHub Pages? You'll need to clear your browser cache and likely wait for GH to pickup the change and flush whatever cache of the site assets it has as well. No idea if there is a way to force that on their end or not. |
Beta Was this translation helpful? Give feedback.
-
You're probably right, I didn't think about the CSS being cached. I'm currently jacking up my DNS settings (lol) so I'll circle back to this a bit later. Thanks for the help. |
Beta Was this translation helpful? Give feedback.
-
Edit: Apparently I have to publish a page change -- then it updates. Success! Thanks again for the help. |
Beta Was this translation helpful? Give feedback.
-
Some quick follow-up, it still isn't working. (And just to be clear, there isn't any caching going on -- I can add a main.CSS, not scss, and it shows up instantly.) I know at this point it's probably nothing in your theme -- I've been talking to GitHub support about this the past few days. But I thought I'd share the weirdness, I suppose. To simplify matters, for testing purposes, the only CSS tag at the end of main.scss is a body background color setting, so it's very obvious when it does work. Bottom line, the file seems to fail with anything in there except regular CSS. When I remove the charset and both imports, it will process. If I add just charset back, it fails. If I add just the imports back, it fails. Even just adding a // comment line to the file causes it to fail. I tried commenting out the skin entry (I'm using neon) and re-testing just charset, then just the imports, and even each individual import (which is nonsense, but I was trying everything), and it fails, so at least the skin files aren't somehow at fault. I even tried both types of comments (inline and block) and they cause failures both ways. Nothing works except plain CSS in the file by itself. I suppose I should clarify all tests had empty front matter. It's all pretty strange -- especially since it did process exactly one time, seemingly at random, but never again. It even failed later on when I set up the file the same way that worked that single time. Hopefully GitHub support can tell us something useful. It sucks that they don't dump build logs somewhere that we can see. |
Beta Was this translation helpful? Give feedback.
-
What's the repo with these changes made that you're not seeing reflected on GH Pages? I'd like to clone it and see if I can reproduce and/or see what's being missed. Because I tried this exact thing from a base MM install locally using the GitHub Pages gem, and it worked perfectly. Can you verify that you've setup your |
Beta Was this translation helpful? Give feedback.
-
Bah, apparently one of the parsers chokes on the UTF-8 Byte Order Marks that Visual Studio insists on slipping into the file when it saves. First time in probably ten years that I've heard of anything not being able to handle the BOM. Oh well. Problem solved. |
Beta Was this translation helpful? Give feedback.
-
@MV10 try running a batch file ( |
Beta Was this translation helpful? Give feedback.
-
Ha, I doubt I've run a batch file in 10 years... Powershell! :) |
Beta Was this translation helpful? Give feedback.
-
Hi all, I'm trying to add /assets/css/main.scss to my project and every time I run |
Beta Was this translation helpful? Give feedback.
-
@elzbth Make sure you're adding it to the root of your project and not in the |
Beta Was this translation helpful? Give feedback.
-
I just ended up here after doing some digging. The solution mentioned here works for me, but only if I put the two lines of triple dashes in the beginning of it. This lines up with what's mentioned in the Jekyll docs here.
|
Beta Was this translation helpful? Give feedback.
-
Currently the font size of post in homepage (summary of all latest post with title and initial paragraph) is in appropriate size. But the actual post (post title and body) font size looks much bigger. Even with this solution post font size can be reduced. But this in turn makes home page fonts size much smaller that is unacceptable. I am looking for solution to keep same font size on home page as well as in post (for both title and body font size) ? Modifying theme's scss file like this solution also not correct I feel. |
Beta Was this translation helpful? Give feedback.
-
@raja-ashok This is an intentional design decision. Excerpt text is smaller than post/page body text. You’ll need to modify the theme’s CSS if you want something different. |
Beta Was this translation helpful? Give feedback.
-
Worked for me! Here's what I used to get a much more natural look. In assets/css/main.scss: ---
# Only the main Sass file needs front matter (the dashes are enough)
---
@charset "utf-8";
@import "minimal-mistakes/skins/{{ site.minimal_mistakes_skin | default: 'default' }}"; // skin
@import "minimal-mistakes"; // main partials
/*
GS: override any CSS with new CSS styles AFTER the `@import "minimal-mistakes";` line just above!
See: https://github.com/mmistakes/minimal-mistakes/issues/1219#issuecomment-326809412
Anything you place after this point will therefore "cascade and override" the previous CSS styles.
*/
/*
GS: Decrease font sizes of the entire website.
Defaults for small, medium, large, and x-large screens are:
16, 18, 20, and 22px, in that order. All other font sizes are "em"
[typography unit](https://en.wikipedia.org/wiki/Em_(typography)) multipliers of these pixel
(px) values, and are therefore relative to and changed by these singular pixel values.
See: https://github.com/mmistakes/minimal-mistakes/issues/1219#issuecomment-326809412
- It looks like the screen pixel sizes to move into each new "size" category are defined in
the "Breakpoints" section of "_variables.scss"?
*/
html {
font-size: 12px; // change to whatever
@include breakpoint($small) {
font-size: 12px; // change to whatever
}
@include breakpoint($medium) {
font-size: 14px; // change to whatever
}
@include breakpoint($large) {
font-size: 16px; // change to whatever
}
@include breakpoint($x-large) {
font-size: 18px; // change to whatever
}
} |
Beta Was this translation helpful? Give feedback.
The way Jekyll handles
_sass
files you have to actually override the entire folder for it to accept any of your changes. So even if you override_reset.scss
it won't take. And as you pointed out that's a large file and probably something you don't want to mess with if possible.There's actually a simpler solution. Because of the way CSS works, you can add all of your custom overrides or "new" CSS to a single file,
assets/css/main.scss
.This file has 2 lines, and the chances of it changing are slim to none since all it does is import another Sass partial that contains all of the theme's components and modules.
So what you can do is add any overriding/new CSS after the
@import minimal-mista…