-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmetal.js
52 lines (44 loc) · 1.11 KB
/
metal.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
const Metalsmith = require("metalsmith");
//Handlebars templates and SCSS
const templates = require("metalsmith-handlebars-contents");
const sass = require("metalsmith-sass");
const dataLoader = require("metalsmith-data-loader");
const renamer = require('./metalsmith-renamer');
let devMode = false;
const smithInstance = Metalsmith(__dirname)
.source("src")
.destination("dist")
.metadata({
author: "Davoleo",
site: "https://davoleo.net"
})
.use(dataLoader({
dataProperty: "data",
removeSource: true,
match: "*.{hbs,html}"
}))
.use(templates({
match: '*.{hbs, html}',
partials: ['src/partials/*'],
helpers: ['./helpers/*']
}))
.use(renamer('*.{hbs, handlebars}', 'html'))
.use(sass({
outputStyle: "expanded",
outputDir: "css/",
sourceMaps: true,
sourceMapsContents: true
}));
function metalsmithBuild() {
smithInstance
.build((err) => {
if (err)
throw err;
});
}
metalsmithBuild();
module.exports = {
smithInstance,
metalsmithBuild,
devMode
};