-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
90 lines (89 loc) · 2.23 KB
/
app.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
'use-strict';
const metalsmith = require('metalsmith');
const markdown = require('metalsmith-markdown');
const layouts = require('metalsmith-layouts');
const permalinks = require('metalsmith-permalinks');
const browserSync = require('metalsmith-browser-sync');
const cleanCss = require('metalsmith-clean-css');
const concat = require('metalsmith-concat');
const sass = require('metalsmith-sass');
const handlebars = require('handlebars');
const collections = require('metalsmith-collections');
const watch = require('metalsmith-watch');
const excerpts = require('metalsmith-excerpts');
const ignore = require('metalsmith-ignore');
const fontBuilder = require('./buildSrc/fontBuilder');
const initHandlebars = require('./buildSrc/handlebarsInit');
const imagePreview = require('./buildSrc/imagePreview');
metalsmith(__dirname)
.source('./src')
.clean(false)
.metadata({
title: "Metalsmith Test",
description: "Hello world!",
generator: "Metalsmith",
url: "http://www.metalsmith.io",
host: "http://node.radiatedpixel.com:5555/"
})
.use(collections({
posts: {
pattern: '**/posts/*.md',
sortBy: 'date',
reverse: true
},
pages: {
pattern: '**/pages/*.md'
}
}))
.use(markdown())
.use(imagePreview())
.use(excerpts())
.use(permalinks({
pattern: ':title',
date: 'YYYY',
linksets: [{
match: { collection: 'posts' },
pattern: 'posts/:date/:title',
date: 'YYYY/MM/DD'
},
{
match: {collection: 'pages' },
pattern: 'pages/:title'
}
]
}))
.use(initHandlebars())
.use(layouts({
'engine' : 'handlebars',
'directory' : './src/layouts'
}))
.use(sass())
.use(fontBuilder('styles'))
.use(concat({
files: 'styles/*.css',
output: 'styles/app.css',
forceOutput: true
}))
.use(cleanCss({
files: 'styles/app.css'
}))
.use(ignore([
'assets/fonts/**',
'layouts/**',
'styles/*.scss'
]))
.use(browserSync({
port: 55555,
files: "./build/**/*.*"
}))
.use(watch({
paths: {
'${source}/**/*.md': '**/*',
'${source}/layouts/**/*': '**/*',
'${source}/styles/*.scss': '**/*'
}
}))
.destination('./build')
.build(function errorCallback(err){
if(err) throw err;
});