Skip to content

Commit fdd8c8f

Browse files
committed
css cached
1 parent 3ab9342 commit fdd8c8f

15 files changed

+132
-17989
lines changed

.eleventy.js

-18
Original file line numberDiff line numberDiff line change
@@ -45,29 +45,11 @@ module.exports = function (eleventyConfig) {
4545

4646
eleventyConfig.addNunjucksFilter('bootstrapNav', toBootstrapNav)
4747

48-
eleventyConfig.addLinter(
49-
'Spelling check',
50-
function (content, inputPath, outputPath) {
51-
let words = 'lenght, .lenght, .rigth'.split(',')
52-
53-
// Eleventy 1.0+: use this.inputPath and this.outputPath instead
54-
if (inputPath.endsWith('.md')) {
55-
for (let word of words) {
56-
let regexp = new RegExp('\\b(' + word + ')\\b', 'gi')
57-
if (content.match(regexp)) {
58-
console.warn(`Spelling check (${inputPath}) Found: ${word}`)
59-
}
60-
}
61-
}
62-
}
63-
)
64-
6548
return {
6649
dir: {
6750
layouts: '/_src/layouts',
6851
data: '/_src/data',
6952
output: '_dist',
70-
pathPrefix: '/Prep-Course/',
7153
},
7254
}
7355
}

.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
node_modules
2+
package-lock.json
23

3-
# Eleventy build
4+
# Eleventy
45
_dist
5-
6+
_cache

_src/data/code.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const Cache = require('@11ty/eleventy-cache-assets')
2+
3+
module.exports = async function () {
4+
const url = 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/code.css'
5+
const style = await Cache(url, {
6+
duration: '1d',
7+
type: 'txt',
8+
directory: '_cache'
9+
})
10+
return style
11+
}

_src/data/fonts.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const Cache = require('@11ty/eleventy-cache-assets')
2+
3+
module.exports = async function () {
4+
const url = 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/fonts.css'
5+
const style = await Cache(url, {
6+
duration: '1d',
7+
type: 'txt',
8+
directory: '_cache'
9+
})
10+
return style
11+
}

_src/data/footer.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const Cache = require('@11ty/eleventy-cache-assets')
2+
3+
module.exports = async function () {
4+
const url = 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/footer.css'
5+
const style = await Cache(url, {
6+
duration: '1d',
7+
type: 'txt',
8+
directory: '_cache'
9+
})
10+
return style
11+
}

_src/data/header.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const Cache = require('@11ty/eleventy-cache-assets')
2+
3+
module.exports = async function () {
4+
const url = 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/header.css'
5+
const style = await Cache(url, {
6+
duration: '1d',
7+
type: 'txt',
8+
directory: '_cache'
9+
})
10+
return style
11+
}

_src/data/lesson.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const Cache = require('@11ty/eleventy-cache-assets')
2+
3+
module.exports = async function () {
4+
const url = 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/lesson.css'
5+
const style = await Cache(url, {
6+
duration: '1d',
7+
type: 'txt',
8+
directory: '_cache'
9+
})
10+
return style
11+
}

_src/data/logoNav.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const Cache = require('@11ty/eleventy-cache-assets')
2+
3+
module.exports = async function () {
4+
const url = 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Assets/logo-henry-white-sm.png'
5+
const imageBuffer = await Cache(url, {
6+
duration: '1d',
7+
type: 'buffer'
8+
})
9+
// Use imageBuffer as an input to the `sharp` plugin, for example
10+
return imageBuffer
11+
// (Example truncated)
12+
}

_src/data/main.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const Cache = require('@11ty/eleventy-cache-assets')
2+
3+
module.exports = async function () {
4+
const url = 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/main.css'
5+
const style = await Cache(url, {
6+
duration: '1d',
7+
type: 'txt',
8+
directory: '_cache'
9+
})
10+
return style
11+
}

_src/data/responsive.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const Cache = require('@11ty/eleventy-cache-assets')
2+
3+
module.exports = async function () {
4+
const url = 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/responsive.css'
5+
const style = await Cache(url, {
6+
duration: '1d',
7+
type: 'txt',
8+
directory: '_cache'
9+
})
10+
return style
11+
}

_src/data/sidebar.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const Cache = require('@11ty/eleventy-cache-assets')
2+
3+
module.exports = async function () {
4+
const url = 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/sidebar.css'
5+
const style = await Cache(url, {
6+
duration: '1d',
7+
type: 'txt',
8+
directory: '_cache'
9+
})
10+
return style
11+
}

_src/data/topbar.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const Cache = require('@11ty/eleventy-cache-assets')
2+
3+
module.exports = async function () {
4+
const url = 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/topbar.css'
5+
const style = await Cache(url, {
6+
duration: '1d',
7+
type: 'txt',
8+
directory: '_cache'
9+
})
10+
return style
11+
}

_src/layouts/lesson.njk

+17-9
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,25 @@ favicon: 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Assets/favicon
1212
<script src="{{ 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js' | url }}" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
1313
<link rel="icon" type="image/x-icon" href="{{ favicon }}">
1414
<link href="{{ 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css' | url }}" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
15-
<link rel="stylesheet" href="{{ 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/fonts.css' | url }}">
16-
<link rel="stylesheet" href="{{ 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/header.css' | url }}">
17-
<link rel="stylesheet" href="{{ 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/main.css' | url }}">
18-
<link rel="stylesheet" href="{{ 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/topbar.css' | url }}">
19-
<link rel="stylesheet" href="{{ 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/sidebar.css' | url }}">
20-
<link rel="stylesheet" href="{{ 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/lesson.css' | url }}">
21-
<link rel="stylesheet" href="{{ 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/code.css' | url }}">
22-
<link rel="stylesheet" href="{{ 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/footer.css' | url }}">
23-
<link rel="stylesheet" href="{{ 'https://henry-11ty-resources.s3.sa-east-1.amazonaws.com/Styles/responsive.css' | url }}">
2415

2516
<title>{{ lessonTitle }} | {{ config.repoTitle }}</title>
17+
18+
{% set css %}
19+
{{ fonts | safe }}
20+
{{ header | safe }}
21+
{{ main | safe }}
22+
{{ topbar | safe }}
23+
{{ sidebar | safe }}
24+
{{ lesson | safe }}
25+
{{ code | safe }}
26+
{{ footer | safe }}
27+
{{ responsive | safe }}
28+
{% endset %}
29+
30+
<style>
31+
{{css | safe}}
32+
</style>
33+
2634
</head>
2735

2836
<body>

0 commit comments

Comments
 (0)