Skip to content

Commit

Permalink
Merge pull request #1 from gowin20/gwen
Browse files Browse the repository at this point in the history
Gwen
  • Loading branch information
gowin20 authored Feb 22, 2024
2 parents df79c67 + 2f4ed63 commit eade6c5
Show file tree
Hide file tree
Showing 66 changed files with 1,663 additions and 682 deletions.
34 changes: 27 additions & 7 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Images
const Image = require("@11ty/eleventy-img");
const CleanCSS = require('clean-css')

const ImageWidths = {
ORIGINAL: null,
Expand Down Expand Up @@ -44,14 +45,12 @@ async function imageShortcode(

module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy("./src/CNAME");
eleventyConfig.addPassthroughCopy("./src/css");
eleventyConfig.addWatchTarget("./src/css/");

eleventyConfig.addPassthroughCopy("./src/images");
eleventyConfig.addWatchTarget("./src/images/");
eleventyConfig.addPassthroughCopy("./src/content");
eleventyConfig.addWatchTarget("./src/content/");
eleventyConfig.addPassthroughCopy("./src/scripts");
eleventyConfig.addWatchTarget("./src/scripts/");

eleventyConfig.addPassthroughCopy("./src/projects");
eleventyConfig.addWatchTarget("./src/projects/");

eleventyConfig.addNunjucksAsyncShortcode("image", imageShortcode);
eleventyConfig.addLiquidShortcode("image", imageShortcode);
Expand Down Expand Up @@ -80,13 +79,34 @@ module.exports = function (eleventyConfig) {
return arr[0];
});

// CSS minifier
eleventyConfig.addFilter('cssMin', css => {
return new CleanCSS({}).minify(css).styles;
});


// Tag-related filters
eleventyConfig.addFilter("getAllTags", collection => {
let tagSet = new Set();
for(let item of collection) {
(item.data.tags || []).forEach(tag => tagSet.add(tag));
}
return Array.from(tagSet);
});

eleventyConfig.addFilter("filterTagList", function filterTagList(tags) {
return (tags || []).filter(tag => ["all", "nav", "post", "posts"].indexOf(tag) === -1);
});


return {
dir: {
input: "src",
output: "public",
markdownTemplateEngine: "md"
includes: "_includes",
layouts: "_layouts",
},
markdownTemplateEngine: "njk",
cname: 'geowen.dev'
};
};
Loading

0 comments on commit eade6c5

Please sign in to comment.