summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhorus_arch2016-12-06 21:32:36 +0100
committerhorus_arch2016-12-06 21:32:36 +0100
commitdf8b3e88c82f0a108a524a4c52eaad6dcb2fbb91 (patch)
tree9c42952b583d353b760b829d99d026b3610f9afd
parentedba558642255b63b4e2fac8d2ef4733d3ccd6aa (diff)
downloadgospeladlershof.de-df8b3e88c82f0a108a524a4c52eaad6dcb2fbb91.tar.gz
Fügt erste Gulp-Tasks beim Build der Webseite hinu. Momentan funktioniert 'UnCSS' noch nicht so, wie es sollte.
-rw-r--r--gospeladlershof.de/Makefile30
-rw-r--r--gospeladlershof.de/gulpfile.js31
-rw-r--r--gospeladlershof.de/layouts/partials/header.tmpl30
-rw-r--r--gospeladlershof.de/layouts/partials/js.tmpl10
4 files changed, 82 insertions, 19 deletions
diff --git a/gospeladlershof.de/Makefile b/gospeladlershof.de/Makefile
index 13e2ba2..23b7e6c 100644
--- a/gospeladlershof.de/Makefile
+++ b/gospeladlershof.de/Makefile
@@ -1,14 +1,23 @@
+
all: build
-build:
- @./build.sh
+build: clean
+ @HUGO_TEST=1 hugo --ignoreCache --log=true --logFile=../log/hugo.log --verbose=false 1>/dev/null \
+ || ( echo "Failure building the site." && exit 1)
+ gulp concat
+ gulp uncss
+ @HUGO_READ_CONCAT=0 HUGO_TEST=0 \
+ hugo --ignoreCache --log=true --logFile=../log/hugo.log --verbose=false \
+ || ( echo "Failure building the site." && exit 1)
+ gulp minifyhtml
+ rm -rf public/css
serve: server
server:
- hugo server
+ HUGO_TEST=0 hugo server
-deploy:
+deploy: build
@if [ -d "/var/www/gospeladlershof.de/gospeladlershof.de/" ]; then \
rsync --delete -avz public/ /var/www/gospeladlershof.de/gospeladlershof.de/; \
else \
@@ -17,3 +26,16 @@ deploy:
clean:
$(RM) $(RMFLAGS) -r public/
+ $(RM) $(RMFLAGS) static/concat.css
+ $(RM) $(RMFLAGS) -r static/gulp.css/
+
+localbuild: clean
+ @HUGO_TEST=1 hugo --baseURL="http://192.168.178.68:3000/" --ignoreCache --log=true --logFile=../log/hugo.log --verbose=false 1>/dev/null \
+ || ( echo "Failure building the site." && exit 1)
+ gulp concat
+ gulp uncss
+ @HUGO_READ_CONCAT=1 HUGO_TEST=0 \
+ hugo --baseURL="http://192.168.178.68:3000/" --ignoreCache --log=true --logFile=../log/hugo.log --verbose=false \
+ || ( echo "Failure building the site." && exit 1)
+ gulp minifyhtml
+ #rm -rf public/css
diff --git a/gospeladlershof.de/gulpfile.js b/gospeladlershof.de/gulpfile.js
new file mode 100644
index 0000000..ec97e58
--- /dev/null
+++ b/gospeladlershof.de/gulpfile.js
@@ -0,0 +1,31 @@
+var gulp = require('gulp');
+var cssnano = require('gulp-cssnano');
+var htmlmin = require('gulp-htmlmin');
+var uncss = require('gulp-uncss');
+var concat = require('gulp-concat');
+
+gulp.task('concat', function() {
+ return gulp.src(['static/css/animate.min.css', 'static/css/bootstrap.min.css', 'static/css/magnific-popup.css', 'static/css/theme.css', 'static/css/chor.css'])
+ .pipe(concat('concat.css'))
+ .pipe(gulp.dest('./static/'));
+});
+
+gulp.task('uncss', function() {
+ return gulp.src('static/concat.css')
+ .pipe(uncss({
+ html: ['public/*.html', 'public/impressum/*.html'],
+ ignore: ['.text-right', '.text-left', '.affix', '.navbar-default.affix']
+ }))
+ .pipe(cssnano())
+ .pipe(gulp.dest('./static/gulp.css'));
+});
+
+gulp.task('minifyhtml', function() {
+ gulp.src('public/*.html')
+ .pipe(htmlmin({collapseWhitespace: true}))
+ .pipe(gulp.dest('public/'));
+ return gulp.src('public/impressum/*.html')
+ .pipe(htmlmin({collapseWhitespace: true}))
+ .pipe(gulp.dest('public/impressum/'));
+});
+
diff --git a/gospeladlershof.de/layouts/partials/header.tmpl b/gospeladlershof.de/layouts/partials/header.tmpl
index 8ff6286..4e68ffe 100644
--- a/gospeladlershof.de/layouts/partials/header.tmpl
+++ b/gospeladlershof.de/layouts/partials/header.tmpl
@@ -20,7 +20,8 @@
<title>{{.Title}}</title>
{{end}}
-{{ if not .Site.Params.cssmin}}
+{{$tmp := getenv "HUGO_TEST"}}
+{{if eq $tmp "1"}}
<!-- Bootstrap Core CSS -->
<link rel="stylesheet" href="{{.Site.BaseURL}}css/bootstrap.min.css" type="text/css">
@@ -37,16 +38,16 @@
<link rel="stylesheet" href="{{.Site.BaseURL}}css/theme.css" type="text/css">
<link rel="stylesheet" href="{{.Site.BaseURL}}css/chor.css" type="text/css">
{{ else }}
- <link rel="stylesheet" href="{{.Site.BaseURL}}css/css.css" type="text/css">
-{{ end }}
- <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
- <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
- <!--[if lt IE 9]>
- <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
- <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
- <![endif]-->
- {{if .Site.Params.enablepiwik}}
+ {{$read := getenv "HUGO_READ_CONCAT"}}
+ {{if eq $read "1"}}
+ <style>
+ {{readFile "static/gulp.css/concat.css" | safeCSS}}
+ </style>
+ {{else}}
+ <link rel="stylesheet" href="{{.Site.BaseURL}}concat.css" type="text/css">
+ {{end}}
+
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
@@ -65,7 +66,14 @@
</script>
<noscript><p><img src="//a.iamfabulous.de/piwik.php?idsite=19&rec=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
- {{end}}
+{{ end }}
+
+ <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
+ <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
+ <!--[if lt IE 9]>
+ <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
+ <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
+ <![endif]-->
<link href="{{.Site.BaseURL}}favicon.ico" rel="shortcut icon">
diff --git a/gospeladlershof.de/layouts/partials/js.tmpl b/gospeladlershof.de/layouts/partials/js.tmpl
index 4cdcde9..f765f4b 100644
--- a/gospeladlershof.de/layouts/partials/js.tmpl
+++ b/gospeladlershof.de/layouts/partials/js.tmpl
@@ -1,4 +1,9 @@
-{{if not .Site.Params.jsmin}}
+
+{{$tmp := getenv "HUGO_TEST-BL"}}
+{{if eq $tmp "1"}}
+ <script src="{{.Site.BaseURL}}js/js.min.js" defer async></script>
+{{else}}
+{{end}}
<!-- jQuery -->
<script src="{{.Site.BaseURL}}js/jquery.min.js"></script>
@@ -13,9 +18,6 @@
<!-- Custom Theme JavaScript -->
<script src="{{.Site.BaseURL}}js/gc.js"></script>
-{{else}}
- <script src="{{.Site.BaseURL}}js/js.min.js" defer async></script>
-{{end}}
</body>