Skip to content
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

Add custom scss #105

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,9 @@ hugo server
colortheme = "white" # dark, light, white, or classic
```

### Custom CSS
### Custom SCSS

```toml
[params]
css = ["css/custom.css"]
```

You can add multiple custom stylesheets which will be loaded after the main theme css.
For example, the above line will load the CSS-file placed at `/static/css/custom.css`.
Add file to folder `assets/scss/custom.scss` to customize generated CSS.

### Navigation

Expand Down
18 changes: 9 additions & 9 deletions assets/scss/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Fonts
$font-family-body: "JetBrains Mono", monospace;
$font-family-mono: "JetBrains Mono", monospace;
$font-family-tt: "Inconsolata", monospace;
$font-size: 14px;
$line-height: 1.725;
$page-width: 48rem;
$font-family-body: "JetBrains Mono", monospace !default;
$font-family-mono: "JetBrains Mono", monospace !default;
$font-family-tt: "Inconsolata", monospace !default;
$font-size: 14px !default;
$line-height: 1.725 !default;
$page-width: 48rem !default;
// Logo
$logo-width: 50px;
$logo-height: 50px;
$logo-grayout: true;
$logo-width: 50px !default;
$logo-height: 50px !default;
$logo-grayout: true !default;
// Colors
$colors: "dark" // white dark light classic
26 changes: 13 additions & 13 deletions assets/scss/colors/classic.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
$color-background: #fafafa;
$color-footer-mobile-1: darken($color-background, 2%);
$color-footer-mobile-2: darken($color-background, 10%);
$color-background-code: darken($color-background, 2%);
$color-border: #666;
$color-meta: #666;
$color-meta-code: lighten($color-meta, 10%);
$color-link: rgba(86, 124, 119, .4);
$color-text: #22272a;
$color-accent-1: #cc2a41;
$color-accent-2: rgba(86, 124, 119, .8);
$color-accent-3: #666;
$color-quote: #cc2a41;
$color-background: #fafafa !default;
$color-footer-mobile-1: darken($color-background, 2%) !default;
$color-footer-mobile-2: darken($color-background, 10%) !default;
$color-background-code: darken($color-background, 2%) !default;
$color-border: #666 !default;
$color-meta: #666 !default;
$color-meta-code: lighten($color-meta, 10%) !default;
$color-link: rgba(86, 124, 119, .4) !default;
$color-text: #22272a !default;
$color-accent-1: #cc2a41 !default;
$color-accent-2: rgba(86, 124, 119, .8) !default;
$color-accent-3: #666 !default;
$color-quote: #cc2a41 !default;
26 changes: 13 additions & 13 deletions assets/scss/colors/dark.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
$color-background: #1d1f21;
$color-footer-mobile-1: lighten($color-background, 2%);
$color-footer-mobile-2: lighten($color-background, 10%);
$color-background-code: lighten($color-background, 2%);
$color-border: #666;
$color-meta: #666;
$color-meta-code: #666;
$color-link: rgba(212, 128, 170, 1);
$color-text: #c9cacc;
$color-accent-3: #cccccc;
$color-accent-2: #eeeeee;
$color-accent-1: #2bbc8a;
$color-quote: #ccffb6;
$color-background: #1d1f21 !default;
$color-footer-mobile-1: lighten($color-background, 2%) !default;
$color-footer-mobile-2: lighten($color-background, 10%) !default;
$color-background-code: lighten($color-background, 2%) !default;
$color-border: #666 !default;
$color-meta: #666 !default;
$color-meta-code: #666 !default;
$color-link: rgba(212, 128, 170, 1) !default;
$color-text: #c9cacc !default;
$color-accent-3: #cccccc !default;
$color-accent-2: #eeeeee !default;
$color-accent-1: #2bbc8a !default;
$color-quote: #ccffb6 !default;
26 changes: 13 additions & 13 deletions assets/scss/colors/light.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// by @GabiThume (https://github.com/gabithume)
$color-background: #e2e0de;
$color-footer-mobile-1: darken($color-background, 2%);
$color-footer-mobile-2: darken($color-background, 10%);
$color-background-code: darken($color-background, 2%);
$color-border: #666;
$color-meta: #666;
$color-meta-code: lighten($color-meta, 10%);
$color-link: rgba(43, 188, 138, 1);
$color-text: #363533;
$color-accent-3: #666666;
$color-accent-2: #111111;
$color-accent-1: #d44375;
$color-quote: #ab2251;
$color-background: #e2e0de !default;
$color-footer-mobile-1: darken($color-background, 2%) !default;
$color-footer-mobile-2: darken($color-background, 10%) !default;
$color-background-code: darken($color-background, 2%) !default;
$color-border: #666 !default;
$color-meta: #666 !default;
$color-meta-code: lighten($color-meta, 10%) !default;
$color-link: rgba(43, 188, 138, 1) !default;
$color-text: #363533 !default;
$color-accent-3: #666666 !default;
$color-accent-2: #111111 !default;
$color-accent-1: #d44375 !default;
$color-quote: #ab2251 !default;
26 changes: 13 additions & 13 deletions assets/scss/colors/white.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// by @sergodeeva (https://github.com/sergodeeva)
$color-background: #FFFFFF;
$color-footer-mobile-1: darken($color-background, 2%);
$color-footer-mobile-2: darken($color-background, 10%);
$color-background-code: darken($color-background, 2%);
$color-border: #666;
$color-meta: #666;
$color-meta-code: lighten($color-meta, 10%);
$color-link: rgba(212, 128, 170, 1);
$color-text: #383838;
$color-accent-3: #8c8c8c;
$color-accent-2: #383838;
$color-accent-1: #2bbc8a;
$color-quote: #2bbc8a;
$color-background: #FFFFFF !default;
$color-footer-mobile-1: darken($color-background, 2%) !default;
$color-footer-mobile-2: darken($color-background, 10%) !default;
$color-background-code: darken($color-background, 2%) !default;
$color-border: #666 !default;
$color-meta: #666 !default;
$color-meta-code: lighten($color-meta, 10%) !default;
$color-link: rgba(212, 128, 170, 1) !default;
$color-text: #383838 !default;
$color-accent-3: #8c8c8c !default;
$color-accent-2: #383838 !default;
$color-accent-1: #2bbc8a !default;
$color-quote: #2bbc8a !default;
Empty file added assets/scss/custom.scss
Empty file.
2 changes: 2 additions & 0 deletions assets/scss/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


@import "variables";
@import "colors/{{ site.Params.colortheme | default "white" }}";
@import "util";
Expand Down
7 changes: 4 additions & 3 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
{{ $colortheme := .Scratch.Get "colortheme" }}

{{- $options := (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" "true") -}}
{{- $styles := resources.Get "scss/style.scss" | resources.ExecuteAsTemplate "scss/style.scss" . | resources.ToCSS $options | resources.Fingerprint "sha512" }}
{{ $custom_css := resources.Get "scss/custom.scss" }}
{{ $css := resources.Get "scss/style.scss" | resources.ExecuteAsTemplate "scss/style.scss" . }}
{{ $resources := slice $custom_css $css }}
{{ $styles := $resources | resources.Concat "scss/styles.scss" | resources.ToCSS $options | resources.Fingerprint "sha512" }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}">

<!-- Custom CSS -->
{{ range .Site.Params.css }} <link rel="stylesheet" href="{{ . | absURL }}"> {{ end }}
{{ `
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
Expand Down