This repository was archived by the owner on Nov 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·136 lines (128 loc) · 4.12 KB
/
index.js
File metadata and controls
executable file
·136 lines (128 loc) · 4.12 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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
const path = require('path');
const Metalsmith = require('metalsmith');
const filter = require('metalsmith-filter');
const htmlMinifier = require('metalsmith-html-minifier');
const beautify = require('metalsmith-beautify');
const layouts = require('metalsmith-layouts');
const permalinks = require('metalsmith-permalinks');
const collections = require('metalsmith-collections');
const sitemap = require('metalsmith-sitemap');
const canonical = require('metalsmith-canonical');
const robots = require('metalsmith-robots');
const rollup = require('metalsmith-rollup');
const babel = require('rollup-plugin-babel');
const uglify = require('rollup-plugin-uglify');
const nodeResolve = require('rollup-plugin-node-resolve');
const sass = require('metalsmith-sass');
const inPlace = require('metalsmith-in-place');
const asset = require('metalsmith-static');
const helpers = require('metalsmith-register-helpers');
const models = require('metalsmith-models');
// const imagemin = require('metalsmith-imagemin');
// const googleAnalytics = require('metalsmith-google-analytics').default;
const ENV = process.env.ENV;
let run = module.exports = function (cb) {
Metalsmith(__dirname)
.metadata({
title: 'CODEZILLA',
description: 'Samen met haar klanten bouwt CODEZILLA complexe (mobiele) web applicaties met optimale gebruikersvriendelijkheid. Dit doet CODEZILLA door het tijdelijk inzetten van professionele, communicatieve en creatieve IT front end vakmensen. ',
url: 'http://www.codezilla.nl/'
})
.source('./content')
.destination('./build')
.use(filter('*.html'))
.clean(true)
.use(permalinks())
.use(canonical({
hostname: 'http://www.codezilla.nl',
omitIndex: true,
omitTrailingSlashes: false
}))
.use(collections({
blocks: {
pattern: '*.html',
sortBy: 'index'
}
}))
.use(models({
directory: 'content/data'
}))
.use(inPlace({
engine: 'handlebars',
partials: './src/partials/'
}))
.use(helpers({
directory: './src/helpers'
}))
.use(layouts({
engine: 'handlebars',
directory: './src/layouts/',
partials: './src/partials/'
}))
.use(htmlMinifier('*.html', {
collapseWhitespace: false,
removeComments: true,
removeAttributeQuotes: false
}))
.use(sitemap({
hostname: 'http://www.codezilla.nl',
omitIndex: true
}))
.use(robots({
allow: ENV === 'PROD' ? ['*'] : [],
disallow: ENV !== 'PROD' ? ['*'] : []
}))
// .use(googleAnalytics('UA-61200557-1'))
.use(beautify({
'js': false,
'html': true
}))
.use(asset({
src: './public',
dest: '.'
}))
.use(rollup({
entry: path.resolve('src/main.js'),
dest: 'bundle.js',
plugins: [
babel({
exclude: 'node_modules/**'
}),
nodeResolve({}),
ENV === 'PROD' ? uglify() : () => {
}
]
}))
.build(function (err, files) {
if (err) {
console.error(err);
}
});
// TODO: Research if this hacky system can be improved
Metalsmith(__dirname)
.source('./src/')
.destination('./build')
.use(filter('*.scss'))
.use(sass({}))
.build(function (err, files) {
if (err) {
console.error(err);
}
if (cb) {
cb();
}
});
Metalsmith(__dirname)
.source('./public/')
.destination('./build')
.use(filter(['**/*.gif', '**/*.png', '**/*.jpg', '**/*.svg']))
.build(function (err, files) {
if (err) {
console.error(err);
}
if (cb) {
cb();
}
});
};
run();