restructure assets

This commit is contained in:
Robert Kaussow 2020-11-22 15:00:45 +01:00
parent e896b54394
commit a28863decf
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
9 changed files with 199 additions and 9 deletions

5
.gitignore vendored
View File

@ -2,7 +2,7 @@
.swp .swp
.env* .env*
dist/ dist/
tmp/ build/
node_modules/ node_modules/
lhci_reports/ lhci_reports/
exampleSite/themes/ exampleSite/themes/
@ -10,9 +10,10 @@ exampleSite/public/
# auto-generated files # auto-generated files
layouts/partials/icons-svg-symbols.html layouts/partials/icons-svg-symbols.html
assets/*.css
static/*.css static/*.css
!static/custom.css !static/custom.css
static/js/*-*.js static/js/*.js
static/favicon/ static/favicon/
static/fonts/GeekblogIcons.* static/fonts/GeekblogIcons.*
resources/ resources/

View File

@ -8,12 +8,13 @@ const iconfont = require("gulp-iconfont");
const realFavicon = require("gulp-real-favicon"); const realFavicon = require("gulp-real-favicon");
const path = require("path"); const path = require("path");
const fs = require("fs"); const fs = require("fs");
const del = require("del");
const svgSprite = require("gulp-svg-sprite"); const svgSprite = require("gulp-svg-sprite");
const rev = require("gulp-rev"); const rev = require("gulp-rev");
var CSSDEST = "static/"; var CSSDEST = "assets/";
var FAVICON_DATA_FILE = "tmp/faviconData.json"; var FAVICON_DATA_FILE = "build/faviconData.json";
var TIMESTAMP = Math.round(Date.now() / 1000); var TIMESTAMP = Math.round(Date.now() / 1000);
gulp.task("sass", function () { gulp.task("sass", function () {
@ -121,7 +122,7 @@ gulp.task("svg-sprite", function () {
padding: 5, padding: 5,
box: "content", box: "content",
}, },
dest: "tmp/intermediate-svg", dest: "build/intermediate-svg",
}, },
svg: { svg: {
xmlDeclaration: false, xmlDeclaration: false,
@ -184,10 +185,10 @@ gulp.task("iconfont", function () {
gulp.task("asset-rev", function () { gulp.task("asset-rev", function () {
return gulp return gulp
.src(["static/*!(custom).min.css", "static/js/*.min.js"], { .src(["assets/*.min.css", "assets/js/*.min.js"], {
base: "static", base: "static",
}) })
.pipe(gulp.dest("tmp/assets")) .pipe(gulp.dest("build/assets"))
.pipe(rev()) .pipe(rev())
.pipe(gulp.dest("static")) .pipe(gulp.dest("static"))
.pipe( .pipe(
@ -200,11 +201,19 @@ gulp.task("asset-rev", function () {
.pipe(gulp.dest("data")); .pipe(gulp.dest("data"));
}); });
gulp.task("asset-rm", function () {
return gulp
.src(["build/assets", "static/js/*-*.js", "static/*-*.js"], { read: false })
.pipe(clean());
});
gulp.task( gulp.task(
"default", "default",
gulp.series("sass", "svg-sprite", "iconfont", "favicon-generate", "asset-rev") gulp.series("sass", "svg-sprite", "iconfont", "favicon-generate", "asset-rev")
); );
gulp.task("asset", gulp.series("asset-rev", "asset-rm"));
gulp.task("devel", function () { gulp.task("devel", function () {
gulp.watch("src/sass/**/*.*css", gulp.series("sass")); gulp.watch("src/sass/**/*.*css", gulp.series("sass", "asset"));
}); });

170
package-lock.json generated
View File

@ -275,6 +275,15 @@
} }
} }
}, },
"array-union": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
"integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=",
"dev": true,
"requires": {
"array-uniq": "^1.0.1"
}
},
"array-uniq": { "array-uniq": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
@ -1238,6 +1247,28 @@
} }
} }
}, },
"del": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz",
"integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=",
"dev": true,
"requires": {
"globby": "^6.1.0",
"is-path-cwd": "^1.0.0",
"is-path-in-cwd": "^1.0.0",
"p-map": "^1.1.1",
"pify": "^3.0.0",
"rimraf": "^2.2.8"
},
"dependencies": {
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
"dev": true
}
}
},
"delayed-stream": { "delayed-stream": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
@ -2698,6 +2729,19 @@
"which": "^1.2.14" "which": "^1.2.14"
} }
}, },
"globby": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
"integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=",
"dev": true,
"requires": {
"array-union": "^1.0.1",
"glob": "^7.0.3",
"object-assign": "^4.0.1",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0"
}
},
"globule": { "globule": {
"version": "1.3.1", "version": "1.3.1",
"resolved": "https://registry.npmjs.org/globule/-/globule-1.3.1.tgz", "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.1.tgz",
@ -2795,6 +2839,71 @@
} }
} }
}, },
"gulp-clean": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/gulp-clean/-/gulp-clean-0.4.0.tgz",
"integrity": "sha512-DARK8rNMo4lHOFLGTiHEJdf19GuoBDHqGUaypz+fOhrvOs3iFO7ntdYtdpNxv+AzSJBx/JfypF0yEj9ks1IStQ==",
"dev": true,
"requires": {
"fancy-log": "^1.3.2",
"plugin-error": "^0.1.2",
"rimraf": "^2.6.2",
"through2": "^2.0.3",
"vinyl": "^2.1.0"
},
"dependencies": {
"arr-diff": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-1.1.0.tgz",
"integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=",
"dev": true,
"requires": {
"arr-flatten": "^1.0.1",
"array-slice": "^0.2.3"
}
},
"arr-union": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/arr-union/-/arr-union-2.1.0.tgz",
"integrity": "sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0=",
"dev": true
},
"array-slice": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz",
"integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=",
"dev": true
},
"extend-shallow": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-1.1.4.tgz",
"integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=",
"dev": true,
"requires": {
"kind-of": "^1.1.0"
}
},
"kind-of": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz",
"integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=",
"dev": true
},
"plugin-error": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-0.1.2.tgz",
"integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=",
"dev": true,
"requires": {
"ansi-cyan": "^0.1.1",
"ansi-red": "^0.1.1",
"arr-diff": "^1.0.1",
"arr-union": "^2.0.1",
"extend-shallow": "^1.1.2"
}
}
}
},
"gulp-clean-css": { "gulp-clean-css": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/gulp-clean-css/-/gulp-clean-css-4.3.0.tgz", "resolved": "https://registry.npmjs.org/gulp-clean-css/-/gulp-clean-css-4.3.0.tgz",
@ -3485,6 +3594,30 @@
} }
} }
}, },
"is-path-cwd": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz",
"integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=",
"dev": true
},
"is-path-in-cwd": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz",
"integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==",
"dev": true,
"requires": {
"is-path-inside": "^1.0.0"
}
},
"is-path-inside": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz",
"integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=",
"dev": true,
"requires": {
"path-is-inside": "^1.0.1"
}
},
"is-plain-obj": { "is-plain-obj": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
@ -5038,6 +5171,12 @@
"p-limit": "^2.0.0" "p-limit": "^2.0.0"
} }
}, },
"p-map": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz",
"integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==",
"dev": true
},
"p-try": { "p-try": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
@ -5109,6 +5248,12 @@
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
"dev": true "dev": true
}, },
"path-is-inside": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz",
"integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=",
"dev": true
},
"path-key": { "path-key": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
@ -5627,6 +5772,31 @@
"integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==",
"dev": true "dev": true
}, },
"rev-del": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/rev-del/-/rev-del-2.0.0.tgz",
"integrity": "sha512-2VavvEMPmvciWcFtHLOJ72qg/OigywOvt+2yrhSXW3ZxNeCfVbCy6Ja0npdSlZiSVBMok7R8RriHeSCx6soEUQ==",
"dev": true,
"requires": {
"del": "^3.0.0",
"lodash": "^4.17.11",
"mocha": "^5.2.0",
"should": "^13.2.3",
"through2": "^3.0.0"
},
"dependencies": {
"through2": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz",
"integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==",
"dev": true,
"requires": {
"inherits": "^2.0.4",
"readable-stream": "2 || 3"
}
}
}
},
"rev-hash": { "rev-hash": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/rev-hash/-/rev-hash-2.0.0.tgz", "resolved": "https://registry.npmjs.org/rev-hash/-/rev-hash-2.0.0.tgz",

View File

@ -16,6 +16,7 @@
"devDependencies": { "devDependencies": {
"gulp": "4.0.2", "gulp": "4.0.2",
"gulp-autoprefixer": "7.0.1", "gulp-autoprefixer": "7.0.1",
"gulp-clean": "^0.4.0",
"gulp-clean-css": "4.3.0", "gulp-clean-css": "4.3.0",
"gulp-concat": "2.6.1", "gulp-concat": "2.6.1",
"gulp-iconfont": "10.0.3", "gulp-iconfont": "10.0.3",
@ -26,6 +27,7 @@
"gulp-svg-sprite": "1.5.0", "gulp-svg-sprite": "1.5.0",
"prettier": "2.1.2", "prettier": "2.1.2",
"prettier-plugin-go-template": "0.0.10", "prettier-plugin-go-template": "0.0.10",
"rev-del": "^2.0.0",
"run-sequence": "2.2.1" "run-sequence": "2.2.1"
}, },
"browserslist": [ "browserslist": [

View File

@ -1,5 +1,5 @@
html { html {
font-size: $font-size-base; font-size: 3rem;
letter-spacing: 0.33px; letter-spacing: 0.33px;
scroll-behavior: smooth; scroll-behavior: smooth;
} }

8
static/assets.json Normal file
View File

@ -0,0 +1,8 @@
{
"custom.css": "custom.css",
"js/clipboard.min.js": "js/clipboard-f06c52bfdd.min.js",
"js/mermaid.min.js": "js/mermaid-ffd6bf77ad.min.js",
"main.min.css": "main-85732d8853.min.css",
"mobile.min.css": "mobile-dc4707ee5b.min.css",
"print.min.css": "print-86167e859a.min.css"
}