This repository was archived by the owner on Feb 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
59 lines (57 loc) · 1.52 KB
/
Copy pathapp.js
File metadata and controls
59 lines (57 loc) · 1.52 KB
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
const htmlStandards = require("reshape-standard");
const pageId = require("spike-page-id");
const ImageminPlugin = require("imagemin-webpack-plugin").default;
const imageminMozjpeg = require("imagemin-mozjpeg");
const sugarml = require("sugarml");
const env = process.env.NODE_ENV;
const locals = require("./locals.js");
const lecture = ctx => {
const pathParts = ctx.resourcePath.split("/");
const filenameParts = pathParts[pathParts.length - 1].split(".");
const lectureName = filenameParts[0];
return locals.lectures.find(l => l.short === lectureName);
};
module.exports = {
matchers: {
html: "views/*(**/)*.sgr"
},
ignore: [
"**/layouts/*.sgr",
"**/_*",
"**/.*",
"readme.md",
"yarn.lock",
"**/includes/**/*.sgr",
"package-lock.json",
"public.git/**"
],
reshape: htmlStandards({
locals: ctx => {
return {
myctx: JSON.stringify(Object.keys(ctx)),
pageId: pageId(ctx),
currentLecture: lecture(ctx),
lectures: locals.lectures,
currentSemester: locals.currentSemester,
base: locals.base,
year: new Date().getFullYear()
};
},
parser: sugarml,
root: process.cwd() + "/views",
minify: env === "production"
}),
vendor: ["assets/js/**", "assets/cubeportfolio/js/**"],
afterSpikePlugins: [
new ImageminPlugin({
disable: process.env.NODE_ENV !== "production",
test: "img/**",
plugins: [
imageminMozjpeg({
quality: 85,
progressive: true
})
]
})
]
};