SASS
Excellent question 🙌 — the way Jekyll themes (like Minima or custom ones on GitHub Pages) organize their Sass (.scss) files can feel a bit mysterious at first. Let’s break down the relationships:
📂 The _sass folder in Jekyll¶
This folder contains partial Sass files (filenames start with
_like_layout.scss,_variables.scss,_base.scss).These files don’t compile into CSS by themselves. Instead, they’re imported into a main stylesheet (often
assets/main.scssorassets/css/style.scss).
🧩 Common Files & Their Roles¶
_variables.scssStores reusable values like:
* These variables get used everywhere else, so if you change$base-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; $base-font-size: 16px; $spacing-unit: 1.5rem; $brand-color: #2a7ae2;$base-font-size, it updates across the site._layout.scssDefines the layout structure of your site:
- Site header (
.site-header) - Navigation bar (
.site-nav) - Posts container (
.post-content) - Sidebar, footer
- It typically uses variables from
_variables.scssso you don’t hardcode sizes/colors.
- Site header (
_base.scss(sometimes called_typography.scssor_reset.scss)Sets global styles:
body { font-family: $base-font-family; font-size: $base-font-size; }- Link styles (
a { color: $brand-color; }) - Headings (
h1, h2, h3 { font-weight: bold; }) - Often imports Google Fonts or sets up the baseline typography for posts.
_syntax-highlighting.scssControls how code blocks look (important for GitHub Pages blogs).
Usually overrides Rouge/Pygments highlighting.
_posts.scssor_blog.scss(if present)Controls post-specific styles:
.post-title,.post-content,.post-meta- Font size, line-height, spacing for blog text
📊 How They Work Together¶
- You have a main SCSS entry file like
assets/main.scss:
---
# Only the front matter makes Jekyll process this as SCSS
---
@import "variables";
@import "base";
@import "layout";
@import "syntax-highlighting";
@import "posts";
Jekyll compiles this into one minified CSS file (
_site/assets/main.css).Your site’s HTML (
_layouts/default.html) links to that CSS.When you tweak
_variables.scss, it flows into_layout.scss,_posts.scss, etc., changing styles everywhere.
🔤 Controlling Post Fonts & Styles¶
If you specifically want to control how posts look (like font family, size, spacing):
Look inside
_base.scssand_posts.scss(or_layout.scssif the theme mixes them).Common selectors:
.post-content {
font-family: $base-font-family;
font-size: 1rem; // inherits from $base-font-size
line-height: 1.7;
}
.post-title {
font-size: 2rem;
font-weight: bold;
}
Change the variables in _variables.scss or override directly in _posts.scss.
âś… Summary:
_variables.scss= the “settings” (fonts, colors, sizes)._base.scss= the “foundation” (typography, reset, global body styles)._layout.scss= the “structure” (header, nav, footer, containers)._posts.scss= the “content styling” (titles, paragraphs, meta).All are imported into
main.scss, which GitHub Pages compiles into your site’s CSS.