diff --git a/compiler/main.ts b/compiler/main.ts index 087448cc..0c1387ab 100644 --- a/compiler/main.ts +++ b/compiler/main.ts @@ -354,6 +354,7 @@ async function compileScss(): Promise { await Deno.run({ cmd: [ IS_WINDOWS ? "npx.cmd" : "npx", + "-y", "node-sass", join(INPUT_DIRECTORY, "css", "style.scss"), "--output-style=compressed", @@ -364,6 +365,27 @@ async function compileScss(): Promise { await ensureDir(join(OUTPUT_DIRECTORY, "css")); await writeFile(join(OUTPUT_DIRECTORY, "css", "style.css"), result); + + console.info("Calling PurgeCSS..."); + const purgeResult = await Deno.run({ + cwd: OUTPUT_DIRECTORY, + cmd: [ + IS_WINDOWS ? "npx.cmd" : "npx", + "-y", + "purgecss", + "--css", + "./css/style.css", + "--content", + "./**/*.html", + "--output", + "./css/style.css", + ], + stdout: "piped", + }).status(); + + if (purgeResult.code !== 0) { + console.error(`PurgeCSS failed with error code ${purgeResult.code}.`); + } } async function copyFonts(): Promise { diff --git a/src/blog/2022/blog-now-runs-on-deno.md b/src/blog/2022/blog-now-runs-on-deno.md index b978bf87..ecd6299c 100644 --- a/src/blog/2022/blog-now-runs-on-deno.md +++ b/src/blog/2022/blog-now-runs-on-deno.md @@ -6,7 +6,7 @@ Tags: deno --- I finally sat down and got my blog compiling with [deno](https://deno.land/). Now that there -is official npm support I didn't need to completely rewrite the compile which was what was +is official npm support I didn't need to completely rewrite the compiler which was what was stopping me before. @@ -22,6 +22,7 @@ const result = new TextDecoder().decode( await Deno.run({ cmd: [ IS_WINDOWS ? "npx.cmd" : "npx", + "-y", "node-sass", join(INPUT_DIRECTORY, "css", "style.scss"), "--output-style=compressed", diff --git a/src/css/style.scss b/src/css/style.scss index aa5e1dad..3d5df774 100644 --- a/src/css/style.scss +++ b/src/css/style.scss @@ -1,6 +1,6 @@ @import "./bootstrap.min.scss"; @import "./icomoon.scss"; -@import "https://unpkg.com/@highlightjs/cdn-assets/styles/vs2015.min.css"; +@import "./vs2015.min.scss"; @font-face { font-family: "Open Sans"; diff --git a/src/css/vs2015.min.scss b/src/css/vs2015.min.scss new file mode 100644 index 00000000..7f6fe11c --- /dev/null +++ b/src/css/vs2015.min.scss @@ -0,0 +1 @@ +pre code.hljs{display:block;overflow-x:auto;padding:1em}code.hljs{padding:3px 5px}.hljs{background:#1e1e1e;color:#dcdcdc}.hljs-keyword,.hljs-literal,.hljs-name,.hljs-symbol{color:#569cd6}.hljs-link{color:#569cd6;text-decoration:underline}.hljs-built_in,.hljs-type{color:#4ec9b0}.hljs-class,.hljs-number{color:#b8d7a3}.hljs-meta .hljs-string,.hljs-string{color:#d69d85}.hljs-regexp,.hljs-template-tag{color:#9a5334}.hljs-formula,.hljs-function,.hljs-params,.hljs-subst,.hljs-title{color:#dcdcdc}.hljs-comment,.hljs-quote{color:#57a64a;font-style:italic}.hljs-doctag{color:#608b4e}.hljs-meta,.hljs-meta .hljs-keyword,.hljs-tag{color:#9b9b9b}.hljs-template-variable,.hljs-variable{color:#bd63c5}.hljs-attr,.hljs-attribute{color:#9cdcfe}.hljs-section{color:gold}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs-bullet,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-selector-pseudo,.hljs-selector-tag{color:#d7ba7d}.hljs-addition{background-color:#144212;display:inline-block;width:100%}.hljs-deletion{background-color:#600;display:inline-block;width:100%} \ No newline at end of file