Skip to content

@jiyinyiyong /compile.coffee
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
the output of fs.watchFile when I save a .coffee file
{spawn} = require 'child_process'
{print} = require 'util'
fs = require 'fs'
coffee_file = 'convert.coffee'
coffee_eval = 'run/eval.coffee'
jade_file = 'html.jade'
stylus_file = 'page.styl'
fs.watchFile coffee_file, (e) ->
result = spawn 'coffee', ['-bc', coffee_file]
msg = ''
result.stderr.on 'data', (str) ->
msg+= str
result.stderr.on 'end', ->
console.log 'msg: ', msg
print "!! #{coffee_file}\n"
fs.watchFile coffee_eval, (e) ->
result = spawn 'coffee', ['-bc', coffee_eval]
msg = ''
result.stderr.on 'data', (str) ->
msg+= str
result.stderr.on 'end', ->
console.log 'msg: ', msg
print "!! #{coffee_eval}\n"
fs.watchFile jade_file, ->
spawn 'jade', [jade_file]
print "!! #{jade_file}\n"
fs.watchFile stylus_file, ->
spawn 'stylus', [stylus_file]
print "!! #{stylus_file}\n"
$ coffee compile.coffee
{ dev: 2053,
ino: 5767525,
mode: 33204,
nlink: 1,
uid: 1000,
gid: 1000,
rdev: 0,
size: 0,
blksize: 4096,
blocks: 0,
atime: Sun, 06 May 2012 08:20:14 GMT,
mtime: Sun, 06 May 2012 10:41:41 GMT,
ctime: Sun, 06 May 2012 10:41:41 GMT }
!! convert.coffee
{ dev: 2053,
ino: 5767525,
mode: 33204,
nlink: 1,
uid: 1000,
gid: 1000,
rdev: 0,
size: 12657,
blksize: 4096,
blocks: 32,
atime: Sun, 06 May 2012 08:20:14 GMT,
mtime: Sun, 06 May 2012 10:41:41 GMT,
ctime: Sun, 06 May 2012 10:41:41 GMT }
!! convert.coffee
msg:
msg:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.