From adce47bd3cb959f73d23af4105b3d20f499aae04 Mon Sep 17 00:00:00 2001 From: punkfairie <23287005+punkfairie@users.noreply.github.com> Date: Sat, 21 Sep 2024 19:56:45 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20ci(start):=20Move=20start=20page?= =?UTF-8?q?=20to=20src=20&=20tell=20eleventy=20to=20build=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eleventy.js | 71 +++++++++++++++++++++++++--------------------- .gitmodules | 2 +- start => src/start | 0 3 files changed, 39 insertions(+), 34 deletions(-) rename start => src/start (100%) diff --git a/.eleventy.js b/.eleventy.js index c8ad073..b7d9611 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,64 +1,69 @@ -const esbuild = require('esbuild') +const esbuild = require("esbuild"); module.exports = function (eleventyConfig) { // Process SCSS - eleventyConfig.addPlugin(require('eleventy-sass'), { - postcss: require('postcss')([ - require('postcss-preset-env'), - require('cssnano'), + eleventyConfig.addPlugin(require("eleventy-sass"), { + postcss: require("postcss")([ + require("postcss-preset-env"), + require("cssnano"), ]), - }) + }); // Add noopener to links - eleventyConfig.addPlugin(require('eleventy-plugin-automatic-noopener'), { + eleventyConfig.addPlugin(require("eleventy-plugin-automatic-noopener"), { noreferrer: true, - }) + }); // Copy CSS assets - eleventyConfig.addPassthroughCopy('src/style/assets') + eleventyConfig.addPassthroughCopy("src/style/assets"); // Copy collections & links - eleventyConfig.addPassthroughCopy('src/collections/images/**/*') - eleventyConfig.addPassthroughCopy('src/images') + eleventyConfig.addPassthroughCopy("src/collections/images/**/*"); + eleventyConfig.addPassthroughCopy("src/images"); + + // start page + eleventyConfig.addPassthroughCopy("src/start/index.html"); + eleventyConfig.addPassthroughCopy("src/start/style.css"); + eleventyConfig.addPassthroughCopy("src/favicon.png"); // Process JS - eleventyConfig.addTemplateFormats('js') - eleventyConfig.addExtension('js', { - outputFileExtension: 'js', + eleventyConfig.addTemplateFormats("js"); + eleventyConfig.addExtension("js", { + outputFileExtension: "js", compile: async (content, path) => { - if (path !== './src/js/main.js') { - return + if (path !== "./src/js/main.js") { + return; } return async () => { const output = await esbuild.build({ - target: 'es2020', + target: "es2020", entryPoints: [path], minify: true, bundle: true, write: false, - }) + }); - return output.outputFiles[0].text - } + return output.outputFiles[0].text; + }; }, - }) + }); // Convert img filename to alt text - eleventyConfig.addFilter('toAlt', (text) => { - const basename = text.split('.') - return basename[0].replace(/-/g, ' ') - }) + eleventyConfig.addFilter("toAlt", (text) => { + const basename = text.split("."); + return basename[0].replace(/-/g, " "); + }); // Convert diary date path to slug - eleventyConfig.addFilter('datePathSlugify', (path) => { - const folders = path.split('/') - const file = folders.pop().split('.') - return `${folders[3]}/${folders[4]}/${file[0]}` - }) + eleventyConfig.addFilter("datePathSlugify", (path) => { + const folders = path.split("/"); + const file = folders.pop().split("."); + return `${folders[3]}/${folders[4]}/${file[0]}`; + }); // RSS - eleventyConfig.addPlugin(require('@11ty/eleventy-plugin-rss')) + eleventyConfig.addPlugin(require("@11ty/eleventy-plugin-rss")); - return {dir: {input: 'src', output: 'dist'}} -} + return { dir: { input: "src", output: "dist" } }; +}; diff --git a/.gitmodules b/.gitmodules index 41bf289..c79c252 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "start"] - path = start + path = src/start url = https://github.com/punkfairie/startpage diff --git a/start b/src/start similarity index 100% rename from start rename to src/start