-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eleventy.js
81 lines (69 loc) · 2.37 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
// @ts-check
const fs = require('fs')
const htmlmin = require('html-minifier')
const pluginRss = require('@11ty/eleventy-plugin-rss')
const markdown = require('./projects/marked/lib/marked')
module.exports = function (eleventyConfig) {
eleventyConfig.setQuietMode(true)
eleventyConfig.setBrowserSyncConfig({
notify: true,
open: true,
callbacks: {
ready: function (err, bs) {
bs.addMiddleware('*', (req, res) => {
const content_404 = fs.readFileSync('www/404.html')
// Provides the 404 content without redirect.
res.write(content_404)
// Add 404 http status code in request header.
// res.writeHead(404, { "Content-Type": "text/html" });
res.writeHead(404)
res.end()
})
}
}
})
eleventyConfig.addPassthroughCopy('apps/**/builds/*.css')
eleventyConfig.addPassthroughCopy('apps/**/builds/*.js')
eleventyConfig.addPassthroughCopy('apps/**/builds/images')
eleventyConfig.addPassthroughCopy('system/styles/css', 'css')
eleventyConfig.addPassthroughCopy('system/js/*.js', 'js')
eleventyConfig.addPassthroughCopy('labs/js/', 'js')
eleventyConfig.addPassthroughCopy('labs/css/', 'css')
eleventyConfig.addPassthroughCopy('system/images', 'images')
eleventyConfig.addWatchTarget('www/**/*.css')
// Minify our HTML
eleventyConfig.addTransform('htmlmin', (content, outputPath) => {
if (outputPath.endsWith('.html')) {
let minified = htmlmin.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true
})
return minified
}
return content
})
/**
* Plugin @shawnsandy/ideas
*
*/
// eleventyConfig.addPlugin(require("@shawnsandy/ideas", {siteMap: ["**/*.njk", "apps/**/*.html"];})); // siteMap defines directory to include
// eleventyConfig.addPlugin(require("@shawnsandy/ideas"));
eleventyConfig.addPlugin(require('./apps/ideas/eleventy'))
eleventyConfig.addPlugin(require('./apps/ideas/lib/markdown'))
eleventyConfig.addPlugin(pluginRss)
eleventyConfig.addPlugin(markdown)
return {
dir: {
output: './www',
input: './src',
includes: '../system/_includes',
data: '../system/_data'
},
templateFormats: ['njk', 'html'],
htmlTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
passthroughFileCopy: true,
pathPrefix: '/'
}
}