forked from manast/adleria.com
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.js
46 lines (39 loc) · 968 Bytes
/
build.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
/*
adleria.com (c) 2016 Optimal Bits Sweden AB.
*/
var marlin = require('marlin');
var handlebars = require('handlebars'),
layouts = require('handlebars-layouts');
handlebars.registerHelper(layouts(handlebars));
handlebars.registerHelper('active', function(page, name){
if(page === name){
return 'class="active"'
}
})
//
// Register handlebars template engine.
//
marlin.register(function(src, ctx){
var template = handlebars.compile(src);
return template(ctx);
}, function(name, src){
handlebars.registerPartial(name, src);
}, ['hbs'], 'html');
//
// Register Sass css preprocessor
//
var sass = require('node-sass');
marlin.register(function(src, ctx){
var result = sass.renderSync({
data: src,
includePaths: [
'./scss',
'./partials'
],
//outputStyle: 'compressed'
});
return result.css;
}, null, ['scss'], 'css');
marlin.build('./', 'build').then(function(site){
console.log('marlin: site:', site);
});