-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.coffee
executable file
·44 lines (36 loc) · 1.05 KB
/
build.coffee
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
process.env.NODE_ENV = 'production'
data = require './data'
nobone = require 'nobone'
_ = require 'lodash'
nb = nobone {
proxy: {}
renderer: {}
service: {}
}
log = nb.kit.log
render = nb.renderer.render
write = nb.kit.outputFile
# # complie md
# weekly = []
# nb.kit.readdir('weekly')
# .done (rs) ->
# weekly = _.without(rs, 'img').reverse()
# write 'weekly.json', JSON.stringify(weekly)
# complie html
render('index.ejs', '.html')
.done (tpl_func) ->
html = tpl_func( { members: data.members } )
write 'index.html', html
.done () ->
log 'complie html done.'.green
# complie stylus
nb.kit.readdir 'css'
.done (files) ->
files.forEach (file) ->
if file.indexOf('.styl') > -1
file = 'css/' + file
render file, '.css'
.done (rs) ->
write file.replace('.styl', '.css'), rs
.done () ->
log ('complie ' + file + ' done.').green