Temporary reference for the pyOpenSci Hugo migration. Focus: how CSS is
organized and built. See also README.md for install and serve commands.
From the repository root:
npm ci
hugo server --disableFastRenderHugo Extended is required (SCSS + PostCSS). The first run needs npm ci so
PostCSS can run during the asset pipeline.
Do not commit build output: public/, resources/, and .hugo_build.lock
are gitignored.
Hugo treats assets/ and static/ differently.
| Location | Role | Committed? | Built on deploy? |
|---|---|---|---|
themes/clean-hugo/assets/css/ |
Main site SCSS source | Yes (source) | Yes → compiled CSS |
themes/clean-hugo/static/css/syntax.css |
Code-block highlighting only | Yes (as-is) | No — copied to site |
There is no static/scss/ folder. All authored styles live under
assets/css/ as SCSS partials.
- Entry file:
themes/clean-hugo/assets/css/main.scss - Partials:
_footer.scss,_blog.scss,_events.scss, etc. - Hugo compiles this at build time (local
hugo serveror Netlify). - Output goes to
public/css/site.min.<hash>.css— never commit that file.
- One pre-generated file for Chroma/monokai highlighting in fenced code blocks.
- Served as
/css/syntax.csswith no processing. - Originally generated with:
hugo gen chromastyles --style=monokai - Not related to layout, footer, blog cards, or brand colors.
Defined in themes/clean-hugo/layouts/_default/baseof.html:
-
Inline brand colors — CSS custom properties from
hugo.toml[params.theme.colors](injected in a<style>block in<head>). -
Main stylesheet — Hugo Pipes pipeline:
{{ $styles := resources.Get "css/main.scss" | toCSS | postCSS | minify | fingerprint }}Steps: SCSS → CSS → PostCSS (autoprefixer) → minify → fingerprinted URL.
-
Syntax CSS — plain link to
/css/syntax.cssfrom themestatic/.
Root package.json and postcss.config.js exist for the Hugo asset pipeline.
main.scss imports partials in this order (simplified):
| Partial | Purpose |
|---|---|
_variables.scss |
Breakpoints, spacing, shadows, typography tokens |
_mixins.scss |
Shared SCSS mixins |
_buttons.scss |
Button tiers |
_utilities.scss |
Skip links, a11y helpers |
| (base rules in site.scss) | Box-sizing, body, headings |
_navigation.scss |
Header, nav, mobile menu |
_content.scss |
Prose / page content |
_blog.scss |
Blog index, single post, archives |
_events.scss |
Events listing and detail |
_footer.scss |
Site footer |
_hero.scss |
Hero sections |
_cards.scss |
Card grids |
_shortcodes.scss |
Shortcode markup (admonitions, cards, etc.) |
_admonition.scss |
Callout blocks |
_code.scss |
Inline code styling (not syntax colors) |
_figure.scss |
Figures and captions |
_docs.scss |
Documentation book layout (sidebar, header, TOC) |
| Other partials | Packages, people, swoosh, filters, home bands, … |
When adding styles, prefer the partial that matches the component. Extend existing partials before adding new files.
Brand colors — set in hugo.toml under [params.theme.colors]. These
become CSS variables (e.g. --color-primary) at build time. Prefer changing
colors there for site-wide brand updates.
SCSS variables — in _variables.scss ($spacing-md, $breakpoint-lg,
etc.). Use for layout, spacing, and component structure inside the theme.
Fonts — loaded via @font-face in main.scss from
themes/clean-hugo/static/fonts/. Font family names are configured in
hugo.toml [params.theme.fonts].
Two different static/ trees:
| Path | Contents |
|---|---|
static/ (repo root) |
Site images (static/images/), favicons, CNAME → published as /images/..., /favicon.ico, etc. |
themes/clean-hugo/static/ |
Theme assets: fonts, JS, css/syntax.css → bundled with theme |
Do not move site images into the theme unless they are truly theme-only.
- Edit SCSS under
themes/clean-hugo/assets/css/. - Save —
hugo server --disableFastRenderrebuilds automatically. - If PostCSS errors mention
npxorpostcss-cli, runnpm ciat repo root. - Commit SCSS changes only — not
public/orresources/.
To regenerate syntax highlighting after changing hugo.toml
[markup.highlight] style:
hugo gen chromastyles --style=monokai > themes/clean-hugo/static/css/syntax.cssThen commit the updated syntax.css.
netlify.toml runs npm ci && hugo --gc --minify. CSS is built on Netlify the
same way as locally. No separate CSS build step or committed compiled bundle is
required for the main stylesheet.
On pull requests and pushes to main, .github/workflows/build-site.yml runs
the same Hugo build as Netlify, then validates the output:
- Setup —
npm ci(PostCSS deps), Hugo Extended 0.139.4 (matchesnetlify.tomlHUGO_VERSION). - Build —
hugo --gc --minifywithHUGO_ENV=production→ output inpublic/. - Link check — lychee against
public/(config inlychee.toml, domain skips in.lycheeignore). - HTML check — htmlproofer on
public/(images and scripts; skips live pyopensci.org URLs that lag deploy).
CircleCI and the CircleCI artifact redirector were removed during the Hugo migration.