Skip to content

Commit

Permalink
Use Hugo extended for Sass/CSS (kubernetes#13113)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucperkins authored and k8s-ci-robot committed Jun 9, 2019
1 parent c133a32 commit 654db85
Show file tree
Hide file tree
Showing 20 changed files with 21 additions and 74 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
**/.DS_Store
**/desktop.ini
_site/**
.sass-cache/**
CNAME
.travis.yml
.idea/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ARG HUGO_VERSION

RUN mkdir -p /usr/local/src && \
cd /usr/local/src && \
curl -L https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_linux-64bit.tar.gz | tar -xz && \
curl -L https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz | tar -xz && \
mv hugo /usr/local/bin/hugo && \
addgroup -Sg 1000 hugo && \
adduser -Sg hugo -u 1000 -h /src hugo
Expand Down
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DOCKER_RUN = $(DOCKER) run --rm --interactive --tty --volume $(CURDIR):/src
NODE_BIN = node_modules/.bin
NETLIFY_FUNC = $(NODE_BIN)/netlify-lambda

.PHONY: all build sass build-preview help serve
.PHONY: all build build-preview help serve

help: ## Show this help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
Expand All @@ -29,12 +29,6 @@ production-build: check-hugo-versions build check-headers-file ## Build the prod
non-production-build: test-examples check-hugo-versions ## Build the non-production site, which adds noindex headers to prevent indexing
hugo --enableGitInfo

sass-build:
scripts/sass.sh build

sass-develop:
scripts/sass.sh develop

serve: ## Boot the development server.
hugo server --buildFuture

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions sass/case-study-styles.sass → assets/sass/style.sass
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@

@import "reset"
@import "skin"

// media queries
@import "base"
@import "case-studies"
@import "tablet"
@import "desktop"

{{ if .Params.case_study_styles }}
@import "case-studies"
{{ end }}
2 changes: 1 addition & 1 deletion content/en/docs/contribute/style/content-organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Some important notes to the files in the bundles:

## Styles

The `SASS` source of the stylesheets for this site is stored below `src/sass` and can be built with `make sass` (note that Hugo will get `SASS` support soon, see https://github.com/gohugoio/hugo/issues/4243).
The [SASS](https://sass-lang.com/) source of the stylesheets for this site is stored in `assets/sass` and is automatically built by Hugo.

{{% /capture %}}

Expand Down
15 changes: 14 additions & 1 deletion layouts/partials/css.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
{{ $inServerMode := site.IsServer }}
{{ $sass := "sass/style.sass" }}
{{ $cssOutput := "css/style.css" }}
{{ $devOpts := (dict "targetPath" $cssOutput "enableSourceMap" true) }}
{{ $prodOpts := (dict "targetPath" $cssOutput "outputStyle" "compressed") }}
{{ $cssOpts := cond $inServerMode $devOpts $prodOpts }}
{{ $css := resources.Get $sass | resources.ExecuteAsTemplate $sass . | toCSS $cssOpts }}
{{ if $inServerMode }}
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
{{ else }}
{{ $prodCss := $css | fingerprint }}
<link rel="stylesheet" href="{{ $prodCss.RelPermalink }}" integrity="{{ $prodCss.Data.Integrity }}">
{{ end }}

<link rel="stylesheet" href="/css/base_fonts.css">
<link rel="stylesheet" href="/css/styles.css">
{{- if .Params.case_study_styles }}
<link rel="stylesheet" href="/css/case-study-styles.css">
{{- end }}
Expand Down
7 changes: 0 additions & 7 deletions sass/styles.sass

This file was deleted.

38 changes: 0 additions & 38 deletions scripts/sass.sh

This file was deleted.

1 change: 0 additions & 1 deletion static/css/case-study-styles.css

This file was deleted.

7 changes: 0 additions & 7 deletions static/css/case-study-styles.css.map

This file was deleted.

1 change: 0 additions & 1 deletion static/css/styles.css

This file was deleted.

7 changes: 0 additions & 7 deletions static/css/styles.css.map

This file was deleted.

0 comments on commit 654db85

Please sign in to comment.