Skip to content

Commit

Permalink
plugins, RSS feed, Lighthouse CI and styles added
Browse files Browse the repository at this point in the history
  • Loading branch information
devenzo35 committed Apr 20, 2021
1 parent 65c2b66 commit 26a668b
Show file tree
Hide file tree
Showing 32 changed files with 75,843 additions and 671 deletions.
1 change: 1 addition & 0 deletions .cache/eleventy-cache-assets-2056cbb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"2056cbb":"1"},{"cachedAt":1618318664576,"type":"2"},"buffer"]
Binary file added .cache/eleventy-cache-assets-2056cbb.buffer
Binary file not shown.
1 change: 1 addition & 0 deletions .cache/eleventy-cache-assets-a9056fa8
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"a9056fa8":"1"},{"cachedAt":1618773403631,"type":"2"},"buffer"]
Binary file added .cache/eleventy-cache-assets-a9056fa8.buffer
Binary file not shown.
1 change: 1 addition & 0 deletions .cache/eleventy-cache-assets-fa4f5409
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"fa4f5409":"1"},{"cachedAt":1618320709129,"type":"2"},"buffer"]
Binary file added .cache/eleventy-cache-assets-fa4f5409.buffer
Binary file not shown.
48 changes: 48 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const eleventyNavigationPlugin = require('@11ty/eleventy-navigation');
const pluginSyntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
const pluginRss = require('@11ty/eleventy-plugin-rss');
const Image = require('@11ty/eleventy-img');
// const pluginRss = require('@11ty/eleventy-plugin-rss')
// const markdownItAnchor = require('markdown-it-anchor');

Expand All @@ -24,6 +26,8 @@ const markdown = md({ html: true, breaks: true, linkify: true }).use(
}
);
module.exports = (config) => {
config.addPlugin(pluginRss);

config.addPassthroughCopy({ public: './' });
// plugins
config.addPlugin(eleventyNavigationPlugin);
Expand Down Expand Up @@ -74,6 +78,50 @@ module.exports = (config) => {
return i.data.tags.some((t) => t.toLowerCase() == tag.toLowerCase());
});
});

config.addNunjucksAsyncShortcode('myImage', async (src, alt) => {
if (!alt) {
throw new Error(`Missing \`alt\` on Image from: ${src}`);
}

let stats = await Image(src, {
widths: [350, 808],
formats: ['jpeg', 'webp'],
urlPath: '/images/home/',
outputDir: '/images/home/',
});

let lowestSrc = stats['jpeg'][0];
let highResJpeg = stats['jpeg'][1];
let lowReswebp = stats['webp'][0];
let highReswebp = stats['webp'][1];

const srcset = Object.keys(stats).reduce(
(acc, format) => ({
...acc,
[format]: stats[format].reduce(
(_acc, curr) => `${_acc} ${curr.srcset} ,`,
''
),
}),
{}
);

const source = `<source type="image/webp" media="(max-width: 629px)" srcset="${lowReswebp.url}" >
<source type="image/webp" media="(min-width: 630px)" srcset="${highReswebp.url}" >
<source type="image/jpeg" media="(max-width: 529px)" srcset="${lowestSrc.url}" >
<source type="image/jpeg" media="(min-width: 630px)" srcset="${highResJpeg.url}" >`;

const img = `<img
loading="lazy"
alt="${alt}"
width="${highResJpeg.width}"
height="${highResJpeg.height}"
src="${lowestSrc.url}">`;

return `<picture>${source}${img}</picture>`;
});

// Create an array of all tags
config.addCollection('tagList', function (collection) {
let tagSet = new Set();
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/lighthouse-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build project and run Lighthouse CI
on: [push]
jobs:
lhci:
name: Lighthouse CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: use Node.js 10.x
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: npm install, build
run: |
yarn
npm run build
- name: run Lighthouse CI
run: |
npm install -g @lhci/[email protected]
lhci autorun
env:
LHCI_GITHUB_APP_TOKEN: ${{secrets.LIGHTHOUSE_APP_TOKEN}}
156 changes: 156 additions & 0 deletions .lighthouseci/assertion-results.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
[
{
"name": "minScore",
"expected": 0.9,
"actual": 0.71,
"values": [
0.71
],
"operator": ">=",
"passed": false,
"auditProperty": "accessibility",
"auditId": "categories",
"level": "warn",
"url": "http://localhost:57916/about/index.html"
},
{
"name": "minScore",
"expected": 0.9,
"actual": 0.55,
"values": [
0.55
],
"operator": ">=",
"passed": false,
"auditProperty": "seo",
"auditId": "categories",
"level": "warn",
"url": "http://localhost:57916/about/index.html"
},
{
"name": "minScore",
"expected": 0.9,
"actual": 0.83,
"values": [
0.83
],
"operator": ">=",
"passed": false,
"auditProperty": "accessibility",
"auditId": "categories",
"level": "warn",
"url": "http://localhost:57916/articles/index.html"
},
{
"name": "minScore",
"expected": 0.9,
"actual": 0.69,
"values": [
0.69
],
"operator": ">=",
"passed": false,
"auditProperty": "seo",
"auditId": "categories",
"level": "warn",
"url": "http://localhost:57916/articles/index.html"
},
{
"name": "minScore",
"expected": 0.9,
"actual": 0.83,
"values": [
0.83
],
"operator": ">=",
"passed": false,
"auditProperty": "accessibility",
"auditId": "categories",
"level": "warn",
"url": "http://localhost:57916/notes/index.html"
},
{
"name": "minScore",
"expected": 0.9,
"actual": 0.87,
"values": [
0.87
],
"operator": ">=",
"passed": false,
"auditProperty": "best-practices",
"auditId": "categories",
"level": "warn",
"url": "http://localhost:57916/notes/index.html"
},
{
"name": "minScore",
"expected": 0.9,
"actual": 0.77,
"values": [
0.77
],
"operator": ">=",
"passed": false,
"auditProperty": "seo",
"auditId": "categories",
"level": "warn",
"url": "http://localhost:57916/notes/index.html"
},
{
"name": "minScore",
"expected": 0.9,
"actual": 0.84,
"values": [
0.84
],
"operator": ">=",
"passed": false,
"auditProperty": "performance",
"auditId": "categories",
"level": "warn",
"url": "http://localhost:57916/products/index.html"
},
{
"name": "minScore",
"expected": 0.9,
"actual": 0.85,
"values": [
0.85
],
"operator": ">=",
"passed": false,
"auditProperty": "accessibility",
"auditId": "categories",
"level": "warn",
"url": "http://localhost:57916/products/index.html"
},
{
"name": "minScore",
"expected": 0.9,
"actual": 0.8,
"values": [
0.8
],
"operator": ">=",
"passed": false,
"auditProperty": "best-practices",
"auditId": "categories",
"level": "warn",
"url": "http://localhost:57916/products/index.html"
},
{
"name": "minScore",
"expected": 0.9,
"actual": 0.77,
"values": [
0.77
],
"operator": ">=",
"passed": false,
"auditProperty": "seo",
"auditId": "categories",
"level": "warn",
"url": "http://localhost:57916/products/index.html"
}
]
Loading

0 comments on commit 26a668b

Please sign in to comment.