From a7424fae97d1d90f11a6c10820d7caaa6eb7a340 Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Tue, 2 Apr 2024 11:36:24 +0200 Subject: [PATCH] build: use postcss --- docs/css/style.css | 51 +++++++++++++++++++++++--------------------- gulpfile.js | 17 +++++++++------ index.html | 2 +- package.json | 10 +++++---- static/style.min.css | 2 +- 5 files changed, 45 insertions(+), 37 deletions(-) diff --git a/docs/css/style.css b/docs/css/style.css index 49da2410..76f818ca 100644 --- a/docs/css/style.css +++ b/docs/css/style.css @@ -17,7 +17,7 @@ --red: #ff2159; /* theme */ --primary-color: var(--gray10); - --secondary-color: var(--red); + --secondary-color: var(--orange); --bg-color: var(--base); --selection-color: #f9e4ac; --serif-font: 'IBM Plex Serif', sans-serif; @@ -26,23 +26,6 @@ --border-color: var(--gray3); } -@keyframes octocat { - 0%, - to { - transform: rotate(0); - } - - 20%, - 60% { - transform: rotate(-25deg); - } - - 40%, - 80% { - transform: rotate(10deg); - } -} - ::selection { background: var(--selection-color); } @@ -79,7 +62,26 @@ img { max-width: 100%; } -.github-corner { +/* github-corner */ + +@keyframes b { + 0%, + 100% { + transform: rotate(0); + } + + 20%, + 60% { + transform: rotate(-25deg); + } + + 40%, + 80% { + transform: rotate(10deg); + } +} + +.github-corner svg { border-bottom: 0; position: fixed; right: 0; @@ -88,17 +90,18 @@ img { z-index: 1; } +.github-corner:hover svg .octo-arm { + opacity: 1; + animation: b 560ms ease-in-out; +} + .github-corner svg { - color: var(--bg-color); + color: #fff; fill: var(--secondary-color); height: 80px; width: 80px; } -.github-corner:hover .octo-arm { - animation: octocat 0.5s ease-in-out; -} - main { display: block; position: relative; diff --git a/gulpfile.js b/gulpfile.js index 31950998..05468573 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,10 +1,8 @@ 'use strict' -const strip = require('gulp-strip-css-comments') -const prefix = require('gulp-autoprefixer') -const cssnano = require('gulp-cssnano') -const uglify = require('gulp-uglify') +const postcss = require('gulp-postcss') const concat = require('gulp-concat') +const uglify = require('gulp-uglify') const gulp = require('gulp') const src = { @@ -24,9 +22,14 @@ const styles = () => gulp .src(src.css) .pipe(concat(`${dist.name.css}.min.css`)) - .pipe(prefix()) - .pipe(strip({ all: true })) - .pipe(cssnano()) + .pipe( + postcss([ + require('postcss-focus'), + require('cssnano')({ + preset: [require('cssnano-preset-advanced')] + }) + ]) + ) .pipe(gulp.dest(dist.path)) const scripts = () => diff --git a/index.html b/index.html index 30263f58..dda9a0f7 100644 --- a/index.html +++ b/index.html @@ -52,8 +52,8 @@ - + diff --git a/package.json b/package.json index ac5f8eba..09110b93 100644 --- a/package.json +++ b/package.json @@ -191,16 +191,18 @@ "browser-sync": "latest", "c8": "latest", "concurrently": "latest", + "cssnano": "latest", + "cssnano-preset-advanced": "latest", "finepack": "latest", "git-authors-cli": "latest", - "gulp": "latest", - "gulp-autoprefixer": "latest", + "gulp": "4", "gulp-concat": "latest", - "gulp-cssnano": "latest", - "gulp-strip-css-comments": "latest", + "gulp-postcss": "latest", "gulp-uglify": "latest", "nano-staged": "latest", "npm-check-updates": "latest", + "postcss": "latest", + "postcss-focus": "latest", "simple-git-hooks": "latest", "ts-standard": "latest" }, diff --git a/static/style.min.css b/static/style.min.css index 685063c2..8c136c7a 100644 --- a/static/style.min.css +++ b/static/style.min.css @@ -1 +1 @@ -:root{--base:#f5f4f4;--black:rgba(18,16,12,.70196);--gray0:#f9f9f9;--gray1:#ededee;--gray2:#e0e1e1;--gray3:#d2d3d4;--gray4:#c3c4c5;--gray5:#b2b3b5;--gray6:#9fa0a2;--gray7:#88898c;--gray8:#6b6c70;--gray9:#3d3f44;--gray10:#000;--orange:#ff5300;--pink:#bc25aa;--red:#ff2159;--primary-color:var(--gray10);--secondary-color:var(--red);--bg-color:var(--base);--selection-color:#f9e4ac;--serif-font:"IBM Plex Serif",sans-serif;--sans-serif-font:"IBM Plex Sans",sans-serif;--code-font:"IBM Plex Mono",monospace;--border-color:var(--gray3)}@keyframes a{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}::selection{background:var(--selection-color)}::-moz-selection{background:var(--selection-color)}*{-webkit-font-smoothing:antialiased;-webkit-overflow-scrolling:touch;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-text-size-adjust:none;-webkit-touch-callout:none;box-sizing:border-box}body,html{height:100%}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--sans-serif-font);font-size:16px;letter-spacing:0;margin:0;overflow-x:hidden}img{max-width:100%}.github-corner{border-bottom:0;position:fixed;right:0;text-decoration:none;top:0;z-index:1}.github-corner svg{color:var(--bg-color);fill:var(--secondary-color);height:80px;width:80px}.github-corner:hover .octo-arm{animation:a .5s ease-in-out}main{display:block;position:relative;width:100vw;height:100%;z-index:0}.sidebar{font-family:var(--sans-serif-font);padding:40px;width:300px;transition:transform .25s ease-out}.sidebar .sidebar-nav{line-height:2em;padding-bottom:40px}.sidebar li{margin:6px 0 6px 15px}.sidebar ul{margin:0;padding:0}.sidebar ul ul{margin-left:15px}.sidebar ul,.sidebar ul li{list-style:none}.sidebar ul li a{display:block;color:var(--gray8);font-size:14px;text-decoration:none}.sidebar ul li a:hover{text-decoration:underline}.sidebar ul li.active>a{border-right:2px solid var(--secondary-color);color:var(--secondary-color);font-weight:700}.sidebar::-webkit-scrollbar{width:4px}.sidebar::-webkit-scrollbar-thumb{background:transparent;border-radius:4px}.sidebar:hover::-webkit-scrollbar-thumb{background:hsla(0,0%,53%,.4)}.sidebar:hover::-webkit-scrollbar-track{background:hsla(0,0%,53%,.1)}body.sticky .sidebar,body.sticky .sidebar-toggle{position:fixed}.content{padding-top:60px;top:0;right:0;bottom:0;left:300px;position:absolute;transition:left .25s ease}.markdown-section{margin:0 auto;max-width:800px;padding:30px 15px 40px;position:relative}.markdown-section>*{box-sizing:border-box;font-size:inherit}.markdown-section>:first-child{margin-top:0!important}@media print{.github-corner,.sidebar,.sidebar-toggle{display:none}}@media screen and (max-width:768px){.github-corner,.sidebar{position:fixed}.sidebar,.sidebar-toggle{display:none}main{height:auto;overflow-x:hidden}.content{left:0;max-width:100vw;position:static;padding-top:20px;transition:transform .25s ease}.github-corner:hover .octo-arm{animation:none}}.sidebar,body{background-color:var(--bg-color);color:var(--primary-color)}.markdown-section :is(h1,h2,h3,h4,h5){font-family:var(--serif-font);letter-spacing:-.016em;line-height:1.25}.markdown-section :is(h1,h2,h3,h4,h5) a:hover:after{content:"#";position:relative;margin-left:6px;display:inline-block}.markdown-section a{color:var(--primary-color);text-decoration:none}.markdown-section :is(li,p) a{color:var(--secondary-color)}.markdown-section :is(li,p) a:hover{text-decoration:underline;text-underline-offset:2px}.markdown-section h1{font-size:2rem;margin:4rem 0 1rem}.markdown-section h2{font-size:1.75rem;margin:3.5rem 0 1rem}.markdown-section h3{font-size:1.5rem;margin:3rem 0 1rem}.markdown-section h4{font-size:1.25rem;margin:2.5rem 0 1rem}.markdown-section h5{font-size:1rem}.markdown-section p{margin:1.2em 0}.markdown-section :is(p,ul){line-height:1.8rem;word-spacing:.05rem}.markdown-section ul li{margin-bottom:10px}.markdown-section ul{padding-left:2rem}.markdown-section blockquote{border-left:2px solid var(--secondary-color);margin:2em 0;padding-left:20px}.markdown-section blockquote p{margin-left:0;padding:12px 0}.markdown-section :is(code,pre,img){border-radius:4px}.markdown-section code{font-family:var(--code-font);border:1px solid var(--border-color);font-size:.75rem;padding:3px 10px;white-space:nowrap}.markdown-section pre{border:1px solid var(--border-color);line-height:1.5rem;margin:1.2em 0;overflow:auto;padding:0 .7rem;position:relative;word-wrap:normal}.markdown-section pre:after{color:var(--gray6);content:attr(data-lang);font-size:.6rem;height:15px;line-height:15px;padding:5px 10px 0;position:absolute;right:0;text-align:right;top:0}.markdown-section :is(pre,pre>code){-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial}.markdown-section pre>code{border:0;display:block;font-family:var(--code-font);font-size:.8rem;line-height:inherit;margin:0 2px;max-width:inherit;overflow:inherit;padding:1.25em 5px;white-space:inherit}.markdown-section :is(code:after,code:before){letter-spacing:.8px;letter-spacing:.05rem}.token:is(.class-name,.function,.number){color:var(--orange)}.token.string{color:var(--pink)}.token:is(.constant,.keyword){color:var(--red)}.token.comment{color:var(--gray8)} \ No newline at end of file +:root{--base:#f5f4f4;--black:rgba(18,16,12,.702);--gray0:#f9f9f9;--gray1:#ededee;--gray2:#e0e1e1;--gray3:#d2d3d4;--gray4:#c3c4c5;--gray5:#b2b3b5;--gray6:#9fa0a2;--gray7:#88898c;--gray8:#6b6c70;--gray9:#3d3f44;--gray10:#000;--orange:#ff5300;--pink:#bc25aa;--red:#ff2159;--primary-color:var(--gray10);--secondary-color:var(--orange);--bg-color:var(--base);--selection-color:#f9e4ac;--serif-font:"IBM Plex Serif",sans-serif;--sans-serif-font:"IBM Plex Sans",sans-serif;--code-font:"IBM Plex Mono",monospace;--border-color:var(--gray3)}::selection{background:var(--selection-color)}::-moz-selection{background:var(--selection-color)}*{-webkit-font-smoothing:antialiased;-webkit-overflow-scrolling:touch;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-text-size-adjust:none;-webkit-touch-callout:none;box-sizing:border-box}body,html{height:100%}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--sans-serif-font);font-size:16px;letter-spacing:0;margin:0;overflow-x:hidden}img{max-width:100%}@keyframes a{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}.github-corner svg{border-bottom:0;position:fixed;right:0;text-decoration:none;top:0;z-index:1}.github-corner:hover svg .octo-arm{animation:a .56s ease-in-out;opacity:1}.github-corner:focus-visible svg .octo-arm{animation:a .56s ease-in-out;opacity:1}.github-corner svg{color:#fff;fill:var(--secondary-color);height:80px;width:80px}main{display:block;height:100%;position:relative;width:100vw;z-index:0}.sidebar{font-family:var(--sans-serif-font);padding:40px;transition:transform .25s ease-out;width:300px}.sidebar .sidebar-nav{line-height:2em;padding-bottom:40px}.sidebar li{margin:6px 0 6px 15px}.sidebar ul{margin:0;padding:0}.sidebar ul ul{margin-left:15px}.sidebar ul,.sidebar ul li{list-style:none}.sidebar ul li a{color:var(--gray8);display:block;font-size:14px;text-decoration:none}.sidebar ul li a:hover{text-decoration:underline}.sidebar ul li a:focus-visible{text-decoration:underline}.sidebar ul li.active>a{border-right:2px solid var(--secondary-color);color:var(--secondary-color);font-weight:700}.sidebar::-webkit-scrollbar{width:4px}.sidebar::-webkit-scrollbar-thumb{background:transparent;border-radius:4px}.sidebar:hover::-webkit-scrollbar-thumb{background:hsla(0,0%,53%,.4)}.sidebar:focus-visible::-webkit-scrollbar-thumb{background:hsla(0,0%,53%,.4)}.sidebar:hover::-webkit-scrollbar-track{background:hsla(0,0%,53%,.1)}.sidebar:focus-visible::-webkit-scrollbar-track{background:hsla(0,0%,53%,.1)}body.sticky .sidebar,body.sticky .sidebar-toggle{position:fixed}.content{bottom:0;left:300px;padding-top:60px;position:absolute;right:0;top:0;transition:left .25s ease}.markdown-section{margin:0 auto;max-width:800px;padding:30px 15px 40px;position:relative}.markdown-section>*{box-sizing:border-box;font-size:inherit}.markdown-section>:first-child{margin-top:0!important}@media print{.github-corner,.sidebar,.sidebar-toggle{display:none}}@media screen and (max-width:768px){.github-corner,.sidebar{position:fixed}.sidebar,.sidebar-toggle{display:none}main{height:auto;overflow-x:hidden}.content{left:0;max-width:100vw;padding-top:20px;position:static;transition:transform .25s ease}.github-corner:hover .octo-arm{animation:none}.github-corner:focus-visible .octo-arm{animation:none}}.sidebar,body{background-color:var(--bg-color);color:var(--primary-color)}.markdown-section :is(h1,h2,h3,h4,h5){font-family:var(--serif-font);letter-spacing:-.016em;line-height:1.25}.markdown-section :is(h1,h2,h3,h4,h5) a:hover:after{content:"#";display:inline-block;margin-left:6px;position:relative}.markdown-section :is(h1,h2,h3,h4,h5) a:focus-visible:after{content:"#";display:inline-block;margin-left:6px;position:relative}.markdown-section a{color:var(--primary-color);text-decoration:none}.markdown-section :is(li,p) a{color:var(--secondary-color)}.markdown-section :is(li,p) a:hover{text-decoration:underline;text-underline-offset:2px}.markdown-section :is(li,p) a:focus-visible{text-decoration:underline;text-underline-offset:2px}.markdown-section h1{font-size:2rem;margin:4rem 0 1rem}.markdown-section h2{font-size:1.75rem;margin:3.5rem 0 1rem}.markdown-section h3{font-size:1.5rem;margin:3rem 0 1rem}.markdown-section h4{font-size:1.25rem;margin:2.5rem 0 1rem}.markdown-section h5{font-size:1rem}.markdown-section p{margin:1.2em 0}.markdown-section :is(p,ul){line-height:1.8rem;word-spacing:.05rem}.markdown-section ul li{margin-bottom:10px}.markdown-section ul{padding-left:2rem}.markdown-section blockquote{border-left:2px solid var(--secondary-color);margin:2em 0;padding-left:20px}.markdown-section blockquote p{margin-left:0;padding:12px 0}.markdown-section :is(code,pre,img){border-radius:4px}.markdown-section code{border:1px solid var(--border-color);font-family:var(--code-font);font-size:.75rem;padding:3px 10px;white-space:nowrap}.markdown-section pre{border:1px solid var(--border-color);line-height:1.5rem;margin:1.2em 0;overflow:auto;padding:0 .7rem;position:relative;word-wrap:normal}.markdown-section pre:after{color:var(--gray6);content:attr(data-lang);font-size:.6rem;height:15px;line-height:15px;padding:5px 10px 0;position:absolute;right:0;text-align:right;top:0}.markdown-section :is(pre,pre>code){-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial}.markdown-section pre>code{border:0;display:block;font-family:var(--code-font);font-size:.8rem;line-height:inherit;margin:0 2px;max-width:inherit;overflow:inherit;padding:1.25em 5px;white-space:inherit}.markdown-section :is(code:after,code:before){letter-spacing:.8px;letter-spacing:.05rem}.token:is(.class-name,.function,.number){color:var(--orange)}.token.string{color:var(--pink)}.token:is(.constant,.keyword){color:var(--red)}.token.comment{color:var(--gray8)} \ No newline at end of file