-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.eleventy.js
95 lines (89 loc) · 3.55 KB
/
.eleventy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
module.exports = function (eleventyConfig) {
// Template libraries
eleventyConfig.setLibrary('njk', require('./lib/_libraries/nunjucks'));
eleventyConfig.setLibrary('md', require('./lib/_libraries/markdown'));
//collections
require('./lib/_javascripts/statusCollections')(eleventyConfig);
//data
const yaml = require('js-yaml');
eleventyConfig.addDataExtension('yaml', (contents) => yaml.load(contents));
// Plugins
eleventyConfig.addPlugin(require('@11ty/eleventy-navigation'));
eleventyConfig.addPlugin(require('@11ty/eleventy-plugin-syntaxhighlight'));
eleventyConfig.addPlugin(require('eleventy-plugin-nesting-toc'), {
tags: ['h2', 'h3'],
wrapper: 'div',
wrapperClass: 'nhsbsa-nav__list',
});
eleventyConfig.addPlugin(require('eleventy-plugin-dart-sass'), {
watch: ['lib/_stylesheets/*.{scss,sass}'],
sassLocation: 'lib/_stylesheets/',
sassIndexFile: 'application.scss',
outputStyle: 'expanded',
outDir: '_site/nhsbsa-digital-playbook/',
outPath: 'stylesheets',
outFileName: 'application.css',
});
eleventyConfig.addPlugin(require('eleventy-plugin-external-links'), {
name: 'external-links',
regex: /^((https?:)|(\/\/))/i, // Regex that test if href is external
target: '_blank',
rel: 'noopener',
extensions: ['.html'],
includeDoctype: true,
});
eleventyConfig.addPlugin(require('eleventy-auto-cache-buster'));
// filters
eleventyConfig.addFilter(
'convertColor',
require('./lib/_filters/convertColor'),
);
eleventyConfig.addFilter('date', require('./lib/_filters/date'));
eleventyConfig.addFilter('fixed', require('./lib/_filters/fixed'));
eleventyConfig.addFilter('markdown', require('./lib/_filters/markdown'));
eleventyConfig.addFilter('pretty', require('./lib/_filters/pretty'));
eleventyConfig.addFilter('slug', require('./lib/_filters/slug'));
eleventyConfig.addFilter('sort', require('./lib/_filters/sort'));
eleventyConfig.addFilter('tokenize', require('./lib/_filters/tokenize'));
eleventyConfig.addFilter(
'totalFromRows',
require('./lib/_filters/total-from-rows'),
);
eleventyConfig.addFilter('widont', require('./lib/_filters/widont'));
eleventyConfig.addFilter(
'sortByOrder',
require('./lib/_filters/sortByOrder'),
);
eleventyConfig.addFilter('blank', require('./lib/_filters/blank'));
eleventyConfig.addFilter('urlEncode', require('./lib/_filters/urlEncode'));
eleventyConfig.addFilter('debug', require('./lib/_filters/debug'));
eleventyConfig.addFilter('absoluteUrl', require('./lib/_filters/urls'));
// pass through
eleventyConfig.addPassthroughCopy({ 'lib/_javascripts': '/javascripts' });
eleventyConfig.addPassthroughCopy({ 'lib/_images': '/images' });
eleventyConfig.addPassthroughCopy({ 'lib/_netlify': '/' });
eleventyConfig.addPassthroughCopy({
'node_modules/nhsuk-frontend/packages/assets': '/nhsuk-frontend/assets',
});
eleventyConfig.addPassthroughCopy({
'node_modules/nhsuk-frontend/dist/*.js': '/javascripts',
});
eleventyConfig.addPassthroughCopy({
'node_modules/@nhsbsa/cookie-consent-component/dist/*.js': '/javascripts',
});
eleventyConfig.addPassthroughCopy('src/**/*.jpg');
eleventyConfig.addPassthroughCopy('src/**/*.jpeg');
eleventyConfig.addPassthroughCopy('src/**/*.png');
eleventyConfig.addPassthroughCopy('src/**/*.docx');
return {
dir: {
input: 'src',
includes: '_includes',
layouts: '_layouts',
output: '_site/nhsbsa-digital-playbook',
},
markdownTemplateEngine: 'njk',
dataTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
};
};