Add gulp css hash filename

This commit is contained in:
kolaente 2020-01-20 22:41:17 +01:00
parent 129b4490cf
commit b436090c64
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
5 changed files with 13 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.idea/
node_modules/
static/styles/main.css
static/styles/main*.css
static/styles/main.css.map

View File

@ -5,6 +5,7 @@ const tar = require('gulp-tar-path');
const gzip = require('gulp-gzip');
const clean = require('gulp-clean');
const cleanCSS = require('gulp-clean-css');
const hash = require('gulp-hash-filename');
const sources = [
'archetypes',
@ -40,6 +41,7 @@ gulp.task('sass-prod', () => {
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(cleanCSS())
.pipe(hash())
.pipe(gulp.dest('./static/styles'));
})

View File

@ -23,8 +23,10 @@
<link rel="canonical" href="{{ .Permalink }}">
<link rel="stylesheet" href="{{ .Site.BaseURL }}styles/main.css">
<link rel="stylesheet" href="{{ .Site.BaseURL }}styles/chroma.css">
{{ $siteBaseURL := .Site.BaseURL }}
{{ range readDir "../../static/styles" }}
<link rel="stylesheet" href="{{ $siteBaseURL }}styles/{{ . }}">
{{ end }}
<link rel="shortcut icon" type="image/x-icon" href="{{ .Site.BaseURL }}favicon.ico">
<link rel="icon" type="image/x-icon" href="{{ .Site.BaseURL }}favicon.ico">

View File

@ -21,6 +21,7 @@
"gulp-clean": "^0.3.2",
"gulp-clean-css": "^4.2.0",
"gulp-gzip": "^1.4.0",
"gulp-hash-filename": "^2.0.1",
"gulp-sass": "^3.1.0",
"gulp-sourcemaps": "^1.9.1",
"gulp-tar-path": "^1.0.1"

View File

@ -1097,6 +1097,11 @@ gulp-gzip@^1.4.0:
stream-to-array "^2.3.0"
through2 "^2.0.3"
gulp-hash-filename@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/gulp-hash-filename/-/gulp-hash-filename-2.0.1.tgz#c30656261a9b622d636766e48b8297125b4ddde8"
integrity sha512-pMg5owb8Dt0wqjgPx/TFbU3c5ckD16rrgo0BTm9PQ3pVC1Zsgw7AYx1+DP2t31JoUTeN1/dPuXNWnCNvN/wj7A==
gulp-sass@^3.1.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/gulp-sass/-/gulp-sass-3.2.1.tgz#2e3688a96fd8be1c0c01340750c191b2e79fab94"