From 628a4df0df81347c74a88e4c110066c9dc6017d1 Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Tue, 11 Sep 2018 16:51:27 +0200 Subject: Refactor partials, layout and sass files --- assets/_markdown.scss | 39 +++++++++++++++++++++ assets/_pure-extension.scss | 55 +++++++++++++++++++++++++++++ assets/_variables.scss | 36 +++++++++++++++++++ assets/markdown.scss | 39 --------------------- assets/pure-extension.scss | 55 ----------------------------- assets/styles.scss | 63 ++++++++++++++++++++++++++-------- assets/variables.scss | 36 ------------------- layouts/docs/baseof.html | 14 +++++--- layouts/docs/index.html | 7 ---- layouts/docs/list.html | 6 ++-- layouts/docs/single.html | 6 +++- layouts/partials/book-brand.html | 3 -- layouts/partials/book-html-head.html | 9 ----- layouts/partials/book-nav.html | 61 -------------------------------- layouts/partials/book-toc.html | 1 - layouts/partials/book/html-head.html | 9 +++++ layouts/partials/book/nav-after.html | 0 layouts/partials/book/nav-auto.html | 63 ++++++++++++++++++++++++++++++++++ layouts/partials/book/nav-brand.html | 3 ++ layouts/partials/book/nav-bundle.html | 5 +++ layouts/partials/book/nav.html | 5 +++ layouts/partials/book/toc.html | 1 + static/css/index.html | 21 ------------ static/css/pure-start.zip | Bin 456 -> 0 bytes 24 files changed, 282 insertions(+), 255 deletions(-) create mode 100644 assets/_markdown.scss create mode 100644 assets/_pure-extension.scss create mode 100644 assets/_variables.scss delete mode 100644 assets/markdown.scss delete mode 100644 assets/pure-extension.scss delete mode 100644 assets/variables.scss delete mode 100644 layouts/docs/index.html delete mode 100644 layouts/partials/book-brand.html delete mode 100644 layouts/partials/book-html-head.html delete mode 100644 layouts/partials/book-nav.html delete mode 100644 layouts/partials/book-toc.html create mode 100644 layouts/partials/book/html-head.html create mode 100644 layouts/partials/book/nav-after.html create mode 100644 layouts/partials/book/nav-auto.html create mode 100644 layouts/partials/book/nav-brand.html create mode 100644 layouts/partials/book/nav-bundle.html create mode 100644 layouts/partials/book/nav.html create mode 100644 layouts/partials/book/toc.html delete mode 100644 static/css/index.html delete mode 100644 static/css/pure-start.zip diff --git a/assets/_markdown.scss b/assets/_markdown.scss new file mode 100644 index 0000000..d2a33ff --- /dev/null +++ b/assets/_markdown.scss @@ -0,0 +1,39 @@ +@import 'variables'; + +$block-border-radius: 0.15rem; + +.markdown { + a { + text-decoration: none; + + &:hover { + text-decoration: underline; + } + } + + code { + font-family: 'Roboto Mono', monospace; + } + + p code { + padding: $padding-1 $padding-4; + background: $gray-100; + border-radius: $block-border-radius; + } + + pre { + padding: $padding-16; + background: $gray-100; + border-radius: $block-border-radius; + font-size: $font-size-14; + } + + blockquote { + border-left: $padding-1*2 solid $gray-300; + margin: 0; + padding: $padding-1 $padding-16; + + :first-child { margin-top: 0; } + :last-child { margin-bottom: 0; } + } +} \ No newline at end of file diff --git a/assets/_pure-extension.scss b/assets/_pure-extension.scss new file mode 100644 index 0000000..e540ef2 --- /dev/null +++ b/assets/_pure-extension.scss @@ -0,0 +1,55 @@ +@import 'variables'; + +html, button, input, select, textarea, .pure-g [class *= "pure-u"] { + font-family: "Open Sans", "Roboto", sans-serif; + font-weight: 300; + +} + +.pure-g { + [class *= "pure-u"] { + box-sizing: border-box; + } +} + +.pure-u { + flex-grow: 1; + width: 0; +} + +.pure-menu-list ul ul { + // left padding for nested sections + padding-left: $padding-16; +} + +.pure-menu-root { + // vertical space between root sections + > li { + padding-bottom: $padding-16; + } + + // font weight only for root sections + > li > .section { + font-weight: 600; + } +} + +.pure-menu-link, .pure-menu-heading { + color: $gray-800; + padding: $padding-4 $padding-16; + text-transform: capitalize; +} + +.pure-menu-link { + &:hover, &.active { + background: none; + } + + &:hover { + color: $gray-600; + } + + &.active { + color: $color-link; + } +} \ No newline at end of file diff --git a/assets/_variables.scss b/assets/_variables.scss new file mode 100644 index 0000000..125a29f --- /dev/null +++ b/assets/_variables.scss @@ -0,0 +1,36 @@ +$padding-1: 1px; //minimal +$padding-4: .25rem; +$padding-8: .5rem; +$padding-16: 1rem; + +$font-size-base: 16px; +$font-size-12: .75rem; +$font-size-14: .875rem; +$font-size-16: 1rem; + +$size-48: 3rem; +$size-56: 3.5rem; +$size-72: 4.5rem; + +// Grayscale +$white: #fff; +$gray-100: #f8f9fa; +$gray-200: #e9ecef; +$gray-300: #dee2e6; +$gray-400: #ced4da; +$gray-500: #adb5bd; +$gray-600: #868e96; +$gray-700: #495057; +$gray-800: #343a40; +$gray-900: #212529; +$black: #000; + +$color-link: #1177EE; +$color-visited-link: #7823c9; + +$body-line-height: 1.75; +$body-min-width: 25rem; +$content-max-width: 64rem; +$content-min-width: $body-min-width; +$nav-menu-width: 18rem; +$toc-menu-width: 14rem; \ No newline at end of file diff --git a/assets/markdown.scss b/assets/markdown.scss deleted file mode 100644 index d2a33ff..0000000 --- a/assets/markdown.scss +++ /dev/null @@ -1,39 +0,0 @@ -@import 'variables'; - -$block-border-radius: 0.15rem; - -.markdown { - a { - text-decoration: none; - - &:hover { - text-decoration: underline; - } - } - - code { - font-family: 'Roboto Mono', monospace; - } - - p code { - padding: $padding-1 $padding-4; - background: $gray-100; - border-radius: $block-border-radius; - } - - pre { - padding: $padding-16; - background: $gray-100; - border-radius: $block-border-radius; - font-size: $font-size-14; - } - - blockquote { - border-left: $padding-1*2 solid $gray-300; - margin: 0; - padding: $padding-1 $padding-16; - - :first-child { margin-top: 0; } - :last-child { margin-bottom: 0; } - } -} \ No newline at end of file diff --git a/assets/pure-extension.scss b/assets/pure-extension.scss deleted file mode 100644 index b4c1ab5..0000000 --- a/assets/pure-extension.scss +++ /dev/null @@ -1,55 +0,0 @@ -@import 'variables'; - -html, button, input, select, textarea, .pure-g [class *= "pure-u"] { - font-family: "Open Sans", "Roboto", sans-serif; - font-weight: 300; - -} - -.pure-g { - [class *= "pure-u"] { - box-sizing: border-box; - } -} - -.pure-u { - flex-grow: 1; - width: 0; -} - -.pure-menu-list ul ul { - // left padding for nested sections - padding-left: $padding-16; -} - -.pure-menu-root { - // vertical space between root sections - > li { - padding-bottom: $padding-16; - } - - // font weight only for root sections - > li > .section { - font-weight: 600; - } -} - -.pure-menu-link, .pure-menu-heading { - color: $gray-800; - padding: $padding-4 $padding-16; - text-transform: capitalize; -} - -.pure-menu-link { - &:hover, &.active { - background: none; - } - - &:hover { - color: $gray-600; - } - - &.active { - color: #1F37E6; - } -} \ No newline at end of file diff --git a/assets/styles.scss b/assets/styles.scss index ff9dd17..e21beab 100644 --- a/assets/styles.scss +++ b/assets/styles.scss @@ -17,28 +17,20 @@ body { line-height: $body-line-height; } -.book-content { - max-width: $content-max-width; - margin: 0 auto; -} - -.book-page { - padding: 0 $size-48; +a { + text-decoration: none; + color: $color-link; } .book-brand { padding: 0 $padding-16; font-weight: 300; - - a { - color: $gray-800; - text-decoration: none; - } } +// Navigation styles .book-nav { - width: $nav-menu-width; flex-grow: 0; + width: $nav-menu-width; nav { position: fixed; @@ -50,14 +42,54 @@ body { font-size: $font-size-14; background: $gray-100; + } + + ul { + list-style: none; padding-left: $padding-16; } + + a { + display: block; + color: $gray-800; + padding: $padding-4 $padding-16; + text-transform: capitalize; + + &[href]:hover { + color: $gray-600; + } + + &.active { + color: $color-link; + } + } + + // class used for sections with bookTopSection: true + .book-nav-section { + margin-bottom: $padding-16; + > a { font-weight: 600; } + > ul { padding-left: 0; } + } +} + +.book-content { + max-width: $content-max-width; + min-width: $content-min-width; + margin: 0 auto; + + .book-page { + padding: $padding-16 $size-48; + } + + a:visited { + color: $color-visited-link + } } +// Table of Contents styles .book-toc { flex-grow: 0; width: $toc-menu-width; - font-size: $font-size-12; nav { position: fixed; @@ -67,6 +99,8 @@ body { overflow-x: hidden; overflow-y: auto; + font-size: $font-size-12; + > ul { margin: $size-48 0; padding: 0 $padding-16; @@ -80,7 +114,6 @@ body { } a { - text-decoration: none; line-height: 1.25; padding: $padding-4 0; display: block; diff --git a/assets/variables.scss b/assets/variables.scss deleted file mode 100644 index 4d4413e..0000000 --- a/assets/variables.scss +++ /dev/null @@ -1,36 +0,0 @@ -$padding-1: 1px; //minimal -$padding-4: .25rem; -$padding-8: .5rem; -$padding-16: 1rem; - -$font-size-base: 16px; -$font-size-12: .75rem; -$font-size-14: .875rem; -$font-size-16: 1rem; - -$size-48: 3rem; -$size-56: 3.5rem; -$size-72: 4.5rem; - -// Grayscale -$white: #fff; -$gray-100: #f8f9fa; -$gray-200: #e9ecef; -$gray-300: #dee2e6; -$gray-400: #ced4da; -$gray-500: #adb5bd; -$gray-600: #868e96; -$gray-700: #495057; -$gray-800: #343a40; -$gray-900: #212529; -$black: #000; - -// $color-link: -// $color-visited-link: - - -$body-line-height: 1.75; -$body-min-width: 25rem; -$content-max-width: 64rem; -$nav-menu-width: 18rem; -$toc-menu-width: 14rem; \ No newline at end of file diff --git a/layouts/docs/baseof.html b/layouts/docs/baseof.html index 7f05ac8..9f7f942 100644 --- a/layouts/docs/baseof.html +++ b/layouts/docs/baseof.html @@ -1,25 +1,31 @@ - {{ partial "book-html-head" . }} - {{ .Site.Title }} + {{ partial "book/html-head" . }} + {{ block "title" . }}{{ .Site.Title }}{{ end }}
+
- {{ partial "book-nav" . }} + {{ partial "book/nav" . }}
+
{{ block "main" . }}{{ end }}
+ {{ if and (default true .Site.Params.BookShowTOC) (.Page.TableOfContents) }}
- {{ partial "book-toc" . }} + {{ partial "book/toc" . }}
+ {{ end }} +
+
\ No newline at end of file diff --git a/layouts/docs/index.html b/layouts/docs/index.html deleted file mode 100644 index 9b519ff..0000000 --- a/layouts/docs/index.html +++ /dev/null @@ -1,7 +0,0 @@ -{{ define "title" }} - {{ .Title }} – {{ .Site.Title }} -{{ end }} - -{{ define "main" }} -
{{ .Content }}
-{{ end }} \ No newline at end of file diff --git a/layouts/docs/list.html b/layouts/docs/list.html index 9b519ff..130cc89 100644 --- a/layouts/docs/list.html +++ b/layouts/docs/list.html @@ -1,7 +1,7 @@ -{{ define "title" }} - {{ .Title }} – {{ .Site.Title }} +{{- define "title" -}} + {{ .Site.Title }} {{ end }} -{{ define "main" }} +{{- define "main" -}}
{{ .Content }}
{{ end }} \ No newline at end of file diff --git a/layouts/docs/single.html b/layouts/docs/single.html index 9b991dd..130cc89 100644 --- a/layouts/docs/single.html +++ b/layouts/docs/single.html @@ -1,3 +1,7 @@ -{{ define "main" }} +{{- define "title" -}} + {{ .Site.Title }} +{{ end }} + +{{- define "main" -}}
{{ .Content }}
{{ end }} \ No newline at end of file diff --git a/layouts/partials/book-brand.html b/layouts/partials/book-brand.html deleted file mode 100644 index 5a2c9cb..0000000 --- a/layouts/partials/book-brand.html +++ /dev/null @@ -1,3 +0,0 @@ -

- {{ .Site.Title }} -

\ No newline at end of file diff --git a/layouts/partials/book-html-head.html b/layouts/partials/book-html-head.html deleted file mode 100644 index 682423f..0000000 --- a/layouts/partials/book-html-head.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - -{{ $styles := resources.Get "styles.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }} - \ No newline at end of file diff --git a/layouts/partials/book-nav.html b/layouts/partials/book-nav.html deleted file mode 100644 index fc89891..0000000 --- a/layouts/partials/book-nav.html +++ /dev/null @@ -1,61 +0,0 @@ -{{ $bookSection := default "docs" .Site.Params.BookSection }} -{{ if eq $bookSection "*" }} - {{ .Scratch.Set "BookSections" .Site.Sections }} -{{ else }} - {{ $bookSections := where .Site.Sections "Section" $bookSection }} - {{ .Scratch.Set "BookSections" $bookSections }} - - {{ if eq (len $bookSections) 1 }} - {{ $singleSection := index $bookSections 0 }} - {{ .Scratch.Set "BookSections" $singleSection.Sections }} - {{ end }} - -{{ end }} - - - - -{{ define "book-section" }} -
  • - {{ template "book-heading" .Section }} - -
  • -{{ end }} - - -{{ define "book-heading" }} - -{{ $sections := split (trim .Dir "/") "/" }} -{{ $title := index ($sections | last 1) 0 | humanize | title }} -{{ $title := default .Title $title }} - -{{ if .Content }} - - {{- $title -}} - -{{ else }} - - {{- $title -}} - -{{ end }} - -{{ end }} diff --git a/layouts/partials/book-toc.html b/layouts/partials/book-toc.html deleted file mode 100644 index 59e6b35..0000000 --- a/layouts/partials/book-toc.html +++ /dev/null @@ -1 +0,0 @@ -{{ .Page.TableOfContents }} \ No newline at end of file diff --git a/layouts/partials/book/html-head.html b/layouts/partials/book/html-head.html new file mode 100644 index 0000000..bf7db42 --- /dev/null +++ b/layouts/partials/book/html-head.html @@ -0,0 +1,9 @@ + + + + + + + +{{ $styles := resources.Get "styles.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }} + \ No newline at end of file diff --git a/layouts/partials/book/nav-after.html b/layouts/partials/book/nav-after.html new file mode 100644 index 0000000..e69de29 diff --git a/layouts/partials/book/nav-auto.html b/layouts/partials/book/nav-auto.html new file mode 100644 index 0000000..c54f960 --- /dev/null +++ b/layouts/partials/book/nav-auto.html @@ -0,0 +1,63 @@ +{{ $bookSection := default "docs" .Site.Params.BookSection }} +{{ if eq $bookSection "*" }} + {{ .Scratch.Set "BookSections" .Site.Sections }} +{{ else }} + {{ $bookSections := where .Site.Sections "Section" $bookSection }} + {{ .Scratch.Set "BookSections" $bookSections }} + + {{ if eq (len $bookSections) 1 }} + {{ $singleSection := index $bookSections 0 }} + {{ .Scratch.Set "BookSections" $singleSection.Sections }} + {{ end }} + +{{ end }} + + + + +{{ define "book-section" }} +
  • + {{ template "book-heading" .Section }} + +
  • +{{ end }} + + +{{ define "book-heading" }} + +{{ $sections := split (trim .Dir "/") "/" }} +{{ $title := index ($sections | last 1) 0 | humanize | title }} +{{ $title := default .Title $title }} + +{{ if .Content }} + + {{- $title -}} + +{{ else }} + + {{- $title -}} + +{{ end }} + +{{ end }} diff --git a/layouts/partials/book/nav-brand.html b/layouts/partials/book/nav-brand.html new file mode 100644 index 0000000..5a2c9cb --- /dev/null +++ b/layouts/partials/book/nav-brand.html @@ -0,0 +1,3 @@ +

    + {{ .Site.Title }} +

    \ No newline at end of file diff --git a/layouts/partials/book/nav-bundle.html b/layouts/partials/book/nav-bundle.html new file mode 100644 index 0000000..46665ad --- /dev/null +++ b/layouts/partials/book/nav-bundle.html @@ -0,0 +1,5 @@ + diff --git a/layouts/partials/book/nav.html b/layouts/partials/book/nav.html new file mode 100644 index 0000000..cc24df7 --- /dev/null +++ b/layouts/partials/book/nav.html @@ -0,0 +1,5 @@ +{{ if .Site.Params.BookMenuBundle }} + {{ partial "book/nav-bundle" . }} +{{ else }} + {{ partial "book/nav-auto" . }} +{{ end }} \ No newline at end of file diff --git a/layouts/partials/book/toc.html b/layouts/partials/book/toc.html new file mode 100644 index 0000000..aca3785 --- /dev/null +++ b/layouts/partials/book/toc.html @@ -0,0 +1 @@ +{{ .Page.TableOfContents }} \ No newline at end of file diff --git a/static/css/index.html b/static/css/index.html deleted file mode 100644 index 05c6126..0000000 --- a/static/css/index.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - Your page title - - - - - - - - - - diff --git a/static/css/pure-start.zip b/static/css/pure-start.zip deleted file mode 100644 index db609b4..0000000 Binary files a/static/css/pure-start.zip and /dev/null differ -- cgit v1.2.3