💚 ci(start): Move start page to src & tell eleventy to build it
This commit is contained in:
parent
9aff45cfa8
commit
adce47bd3c
3 changed files with 39 additions and 34 deletions
71
.eleventy.js
71
.eleventy.js
|
@ -1,64 +1,69 @@
|
||||||
const esbuild = require('esbuild')
|
const esbuild = require("esbuild");
|
||||||
|
|
||||||
module.exports = function (eleventyConfig) {
|
module.exports = function (eleventyConfig) {
|
||||||
// Process SCSS
|
// Process SCSS
|
||||||
eleventyConfig.addPlugin(require('eleventy-sass'), {
|
eleventyConfig.addPlugin(require("eleventy-sass"), {
|
||||||
postcss: require('postcss')([
|
postcss: require("postcss")([
|
||||||
require('postcss-preset-env'),
|
require("postcss-preset-env"),
|
||||||
require('cssnano'),
|
require("cssnano"),
|
||||||
]),
|
]),
|
||||||
})
|
});
|
||||||
|
|
||||||
// Add noopener to links
|
// Add noopener to links
|
||||||
eleventyConfig.addPlugin(require('eleventy-plugin-automatic-noopener'), {
|
eleventyConfig.addPlugin(require("eleventy-plugin-automatic-noopener"), {
|
||||||
noreferrer: true,
|
noreferrer: true,
|
||||||
})
|
});
|
||||||
|
|
||||||
// Copy CSS assets
|
// Copy CSS assets
|
||||||
eleventyConfig.addPassthroughCopy('src/style/assets')
|
eleventyConfig.addPassthroughCopy("src/style/assets");
|
||||||
|
|
||||||
// Copy collections & links
|
// Copy collections & links
|
||||||
eleventyConfig.addPassthroughCopy('src/collections/images/**/*')
|
eleventyConfig.addPassthroughCopy("src/collections/images/**/*");
|
||||||
eleventyConfig.addPassthroughCopy('src/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
|
// Process JS
|
||||||
eleventyConfig.addTemplateFormats('js')
|
eleventyConfig.addTemplateFormats("js");
|
||||||
eleventyConfig.addExtension('js', {
|
eleventyConfig.addExtension("js", {
|
||||||
outputFileExtension: 'js',
|
outputFileExtension: "js",
|
||||||
compile: async (content, path) => {
|
compile: async (content, path) => {
|
||||||
if (path !== './src/js/main.js') {
|
if (path !== "./src/js/main.js") {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return async () => {
|
return async () => {
|
||||||
const output = await esbuild.build({
|
const output = await esbuild.build({
|
||||||
target: 'es2020',
|
target: "es2020",
|
||||||
entryPoints: [path],
|
entryPoints: [path],
|
||||||
minify: true,
|
minify: true,
|
||||||
bundle: true,
|
bundle: true,
|
||||||
write: false,
|
write: false,
|
||||||
})
|
});
|
||||||
|
|
||||||
return output.outputFiles[0].text
|
return output.outputFiles[0].text;
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
// Convert img filename to alt text
|
// Convert img filename to alt text
|
||||||
eleventyConfig.addFilter('toAlt', (text) => {
|
eleventyConfig.addFilter("toAlt", (text) => {
|
||||||
const basename = text.split('.')
|
const basename = text.split(".");
|
||||||
return basename[0].replace(/-/g, ' ')
|
return basename[0].replace(/-/g, " ");
|
||||||
})
|
});
|
||||||
|
|
||||||
// Convert diary date path to slug
|
// Convert diary date path to slug
|
||||||
eleventyConfig.addFilter('datePathSlugify', (path) => {
|
eleventyConfig.addFilter("datePathSlugify", (path) => {
|
||||||
const folders = path.split('/')
|
const folders = path.split("/");
|
||||||
const file = folders.pop().split('.')
|
const file = folders.pop().split(".");
|
||||||
return `${folders[3]}/${folders[4]}/${file[0]}`
|
return `${folders[3]}/${folders[4]}/${file[0]}`;
|
||||||
})
|
});
|
||||||
|
|
||||||
// RSS
|
// 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" } };
|
||||||
}
|
};
|
||||||
|
|
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -1,3 +1,3 @@
|
||||||
[submodule "start"]
|
[submodule "start"]
|
||||||
path = start
|
path = src/start
|
||||||
url = https://github.com/punkfairie/startpage
|
url = https://github.com/punkfairie/startpage
|
||||||
|
|
Loading…
Reference in a new issue