diff options
author | Hanzei <hanzei@mailbox.org> | 2018-07-10 10:23:19 +0300 |
---|---|---|
committer | Hanzei <hanzei@mailbox.org> | 2018-07-10 10:23:19 +0300 |
commit | 79574f632eea9470fc14d9cd345beb07bb9353ad (patch) | |
tree | bd0b78129e0ece6506bab26778fdea4eda21dd40 /layouts | |
parent | 1c5ab5a047d98d2454a086942204e2a09c684be7 (diff) |
Use hugo sass prozessing
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/baseof.html | 4 | ||||
-rw-r--r-- | layouts/index.html | 2 | ||||
-rw-r--r-- | layouts/partials/head/css.html | 14 | ||||
-rw-r--r-- | layouts/partials/nav.html | 65 |
4 files changed, 58 insertions, 27 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 479632d..0e3d569 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -12,7 +12,7 @@ {{ end }} </head> <body> - <div class="section" id="top"> + <section class="section" id="top"> <!-- Begin Title --> <div class="container hero {{ if .Site.Params.fadeIn | default true }} fade-in one {{ end }}"> {{ block "title" . }} @@ -31,7 +31,7 @@ {{ partial "footer/text.html" . }} {{ end }} </div> - </div> + </section> {{ block "js-include" . }} {{ partial "footer/scripts.html" . }} {{ end }} diff --git a/layouts/index.html b/layouts/index.html index 69da4c6..a46af74 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -31,7 +31,7 @@ </div> <!-- Done with Hero --> <!-- Everything below fades in three! --> - <div class="section no-padding {{ if .Site.Params.fadeIn | default true }}fade-in three{{ end }}"> + <div class="section {{ if .Site.Params.fadeIn | default true }}fade-in three{{ end }}"> <!-- Tell them all about it! --> {{ partial "nav.html" . }} {{ with .Site.GetPage "page" "about" }} diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html index 2813437..e280aa5 100644 --- a/layouts/partials/head/css.html +++ b/layouts/partials/head/css.html @@ -1,12 +1,16 @@ <!-- Fonts and icon CSS --> <link rel="stylesheet" href="{{ "/css/font-awesome.min.css" | relURL }}"> -<link rel="stylesheet" href="{{ "/css/nunito_sans.css" | relURL }}"> -<!-- Main css --> -{{ if .Site.Params.cacheBuster }} - <link rel="stylesheet" href="{{ (printf "css/%s-style.css?t=%d" (.Site.Params.themeStyle | default "dark") now.Unix) |relURL }}"> +{{ $file := "sass/style.sass" }} +{{ if .Site.IsServer }} +{{ $cssOpts := (dict "targetPath" "styles/main.css" "enableSourceMap" true ) }} +{{ $styles := resources.Get $file | resources.ExecuteAsTemplate "style/main.tmp.css" . | toCSS $cssOpts }} +<link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen"> {{ else }} - <link rel="stylesheet" href="{{ (printf "css/%s-style.css" .Site.Params.themeStyle | default "dark") | relURL }}"> +{{ $cssOpts := (dict "targetPath" "styles/main.css" ) }} +{{ $postCSSOpts := (dict "use" "autoprefixer" ) }} +{{ $styles := resources.Get $file | resources.ExecuteAsTemplate "style/main.tmp.css" . | toCSS $cssOpts | postCSS $postCSSOpts | minify | fingerprint }} +<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen"> {{ end }} <!-- Custom css --> diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index 46850c7..83d5744 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -1,33 +1,33 @@ <!-- Begin Nav bar --> <div class="container"> <hr> - <nav class="nav nav-center"> + <nav class="navbar" role="navigation" aria-label="main navigation"> {{ $isHome := .Page.IsHome }} - <span id="nav-toggle" class="nav-toggle" onclick="document.getElementById('nav-menu').classList.toggle('is-active');"> - <span></span> - <span></span> - <span></span> - </span> - <div id="nav-menu" class="nav-left nav-menu"> + <a role="button" class="navbar-burger" data-target="navMenu" aria-label="menu" aria-expanded="false" > + <span aria-hidden="true"></span> + <span aria-hidden="true"></span> + <span aria-hidden="true"></span> + </a> + <div class="navbar-menu" id="navMenu"> <!-- look for custom menu and include it --> {{ if .Site.Menus.main }} {{ range .Site.Menus.main }} {{ if .HasChildren }} - <a class="nav-item" href="{{ .URL }}"> + <a class="navbar-item" href="{{ .URL }}"> {{ .Pre }} {{ .Name }} {{ .Post }} </a> {{ range .Children }} <!-- TODO: style children diffrent then parents--> - <a class="nav-item" href="{{ .URL }}"> + <a class="navbar-item" href="{{ .URL }}"> {{ .Pre }} {{ .Name }} {{ .Post }} </a> {{ end }} {{ else }} - <a class="nav-item" href="{{ .URL }}"> + <a class="navbar-item" href="{{ .URL }}"> {{ .Pre }} {{ .Name }} {{ .Post }} @@ -37,19 +37,19 @@ {{ else }} <!-- use default menu --> {{ if not $isHome }} - <a class="nav-item" href="{{ "/" | relLangURL }}">{{ i18n "nav_main" . }}</a> + <a class="navbar-item" href="{{ "/" | relLangURL }}">{{ i18n "nav_main" . }}</a> {{ end }} {{ with .Site.GetPage "page" "about" }} - <a class="nav-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "/#%s" .File.TranslationBaseName | relLangURL }}{{ end }}">{{ .Title }}</a> + <a class="navbar-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "/#%s" .File.TranslationBaseName | relLangURL }}{{ end }}">{{ .Title }}</a> {{ end }} {{ $pageIsInProjects := eq .Page.Section "projects"}} {{ if not (and $pageIsInProjects (eq .Page.Kind "section")) }} {{ with .Site.GetPage "section" "projects" }} {{ if $isHome }} - <a class="nav-item" href="#{{ .Title | urlize }}">{{ .Title }}</a> + <a class="navbar-item" href="#{{ .Title | urlize }}">{{ .Title }}</a> {{ else }} - <a class="nav-item" href="{{ .RelPermalink }}"> + <a class="navbar-item" href="{{ .RelPermalink }}"> {{ if $pageIsInProjects }} {{ i18n "nav_backToSection" . }} {{ else }} @@ -64,9 +64,9 @@ {{ if not (and $pageIsInBlog (eq .Page.Kind "section")) }} {{ with .Site.GetPage "section" "blog" }} {{ if $isHome }} - <a class="nav-item" href="#{{ .Title | urlize }}">{{ .Title }}</a> + <a class="navbar-item" href="#{{ .Title | urlize }}">{{ .Title }}</a> {{ else }} - <a class="nav-item" href="{{ .RelPermalink }}"> + <a class="navbar-item" href="{{ .RelPermalink }}"> {{ if $pageIsInBlog }} Back to {{ .Title | singularize}} {{ else }} @@ -78,21 +78,48 @@ {{ end }} {{ with .Site.GetPage "page" "contact" }} - <a class="nav-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "/#%s" .File.TranslationBaseName | relLangURL }}{{ end }}">{{ .Title }}</a> + <a class="navbar-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "/#%s" .File.TranslationBaseName | relLangURL }}{{ end }}">{{ .Title }}</a> {{ end }} {{ if gt (len $.Site.Home.AllTranslations.ByWeight) 1 }} {{ range $.Site.Home.AllTranslations.ByWeight }} - <a class="nav-item" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a> + <a class="navbar-item" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a> {{ end }} {{ end }} {{ if and .Site.Params.showRSSButton .Site.RSSLink }} - <a class="nav-item" href="{{ .Site.RSSLink }}"><i class="fa fa-rss"></i></a> + <a class="navbar-item" href="{{ .Site.RSSLink }}"><i class="fa fa-rss"></i></a> {{ end }} {{ end }} </div> </nav> <hr> </div> +<script> +document.addEventListener('DOMContentLoaded', function () { + + // Get all "navbar-burger" elements + var $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0); + + // Check if there are any navbar burgers + if ($navbarBurgers.length > 0) { + + // Add a click event on each of them + $navbarBurgers.forEach(function ($el) { + $el.addEventListener('click', function () { + + // Get the target from the "data-target" attribute + var target = $el.dataset.target; + var $target = document.getElementById(target); + + // Toggle the class on both the "navbar-burger" and the "navbar-menu" + $el.classList.toggle('is-active'); + $target.classList.toggle('is-active'); + + }); + }); + } + +}); +</script> <!-- End Nav bar --> |