From bb0cfc464f1ead2b4998974ea6d573b6ed8b2367 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 2 Jun 2020 19:43:52 +0200 Subject: [PATCH] beautify html before uploading the documentation --- .drone.yml | 11 ++++++++++- .jsbeautifyrc | 8 ++++++++ layouts/partials/head.html | 11 ++++------- 3 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 .jsbeautifyrc diff --git a/.drone.yml b/.drone.yml index afdfa9f..2918950 100644 --- a/.drone.yml +++ b/.drone.yml @@ -138,6 +138,15 @@ steps: commands: - hugo-official -s exampleSite/ +- name: beautify + image: node:lts-alpine + commands: + - npm install -g js-beautify + - html-beautify -r -f 'exampleSite/public/**/*.html' + environment: + FORCE_COLOR: true + NPM_CONFIG_LOGLEVEL: error + - name: publish image: plugins/s3-sync settings: @@ -206,6 +215,6 @@ depends_on: --- kind: signature -hmac: c9158b4a7c4fb787644c711560925ffae038a982953f958d5f535158f640032f +hmac: 0e4002121787435d22c628f091c8b11ceec1c8a02057436dc9a868c190f91317 ... diff --git a/.jsbeautifyrc b/.jsbeautifyrc new file mode 100644 index 0000000..ffbbba3 --- /dev/null +++ b/.jsbeautifyrc @@ -0,0 +1,8 @@ +{ + "indent_size": 4, + "indent_char": " ", + "preserve_newlines": false, + "unformatted" : ["svg"], + "content_unformatted": ["pre"], + "extra_liners": ["head", "body", "html", "main", "header", "footer", "section"] +} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index ac35c60..daa0c0b 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -3,18 +3,15 @@ {{ partial "title" . }} | {{ .Site.Title -}} - + - - {{ with .OutputFormats.Get "rss" -}} {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ end -}} -{{ "" | safeHTML }} +{{ "" | safeHTML }}