-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile.coffee
30 lines (28 loc) · 933 Bytes
/
compile.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
pug = require('pug')
fs = require('fs')
sha1 = require('sha1')
js2coffee = require('js2coffee')
CoffeeScript = require('coffeescript')
compile = (file, locals) ->
#Jade Compilation
text = fs.readFileSync(file + 'index.jade', 'utf8')
fn = pug.compileFile(file + 'index.jade', 'pretty': true)
hash = sha1(text)
html = fn(Object.assign({}, locals, 'hash': hash))
fs.writeFile file + 'index.html', html, (err) ->
if err
return console.log(err)
process.stdout.write '✅ '
console.log file + 'index.jade compiled.'
return
return
compile '', prefix: './'
compile 'blog/', prefix: '../blog/'
compile 'matrix/', prefix: '../matrix/'
compile 'resume/', prefix: '../resume/'
compile 'stats/', prefix: '../stats/'
compile 'tools/', prefix: '../tools/'
compile 'typing/', prefix: '../typing/'
compile 'weather/', prefix: '../weather/'
compile '404/', prefix: '../404/'
compile 'snake/', prefix: '../snake/'