-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathbuild.js
More file actions
41 lines (30 loc) · 1.02 KB
/
build.js
File metadata and controls
41 lines (30 loc) · 1.02 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
process.env.NODE_ENV='production';
var fs = require('fs'),
mkdirp = require('mkdirp'),
page = require('./dev/bundleStaticPage.js'),
paths = require('./paths'),
webpack = require('webpack'),
config = require('./webpack.config');
webpack(config[1], function(err, stats) {
if(err) {
console.log(err);
} else {
var assets = 'public/assets';
mkdirp.sync(assets);
fs.writeFileSync(assets + '/pure.css', fs.readFileSync('bower_components/pure/pure.css'));
fs.writeFileSync(assets + '/style.css', fs.readFileSync('elements/style.css'));
for(var path in paths.allPaths()) {
if(path!=='posts') {
mkdirp.sync('public' + path);
fs.writeFileSync('public' + path + '/index.html', page(path));
console.log(path);
}
}
mkdirp.sync('public/blog');
for(var post in paths.allPosts()) {
fs.writeFileSync('public/blog/' + post + '.html', page('/blog/' + post));
console.log('blog/' + post + '.html');
}
}
console.log('build complete');
});