-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_page.js
28 lines (25 loc) · 942 Bytes
/
build_page.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
var pug = require('pug');
var sass = require('node-sass');
var fs = require('fs');
var async = require('async');
function generateStylesheet(inFilename, outFilename, callback) {
async.waterfall([
async.apply(sass.render, {file: inFilename}),
function (input, callback) {callback(null, input.css);},
async.apply(fs.writeFile, outFilename)
], callback);
}
function generateView(inFilename, outFilename, callback) {
async.waterfall([
function (callback) { callback(null, pug.renderFile(inFilename)); },
async.apply(fs.writeFile, outFilename)
], callback);
}
async.parallel([
async.apply(generateView, 'views/index.pug', 'index.html'),
async.apply(generateStylesheet, 'stylesheets/main.scss', 'css/main.css'),
async.apply(generateStylesheet, 'stylesheets/supergrid.scss', 'css/supergrid.css')
], function (err) {
if (err) throw err;
console.log('Build complete');
});