werkzeug
Version:
compiles ts, coffee, sass/scss, less/ stylus and packs browser ready bundles
65 lines (48 loc) • 1.46 kB
text/coffeescript
Path = require 'path'
CP = require 'child_process'
SW = require './utils/stopwatch'
IPC = require './utils/ipc'
Log = require './utils/log'
PACKER = Path.join __dirname, 'packer', 'packer-process'
class Packer
constructor: () ->
= null
= []
= false
= .cfg
= new IPC(CP.fork(PACKER), @)
.send 'init',
pack: (files) ->
packs = .packer.packages
if files and files.length and packs and packs.length
Log.info 'packer', 'starting ...'
SW.start 'packer'
if not
.send 'readPackages'
else
.send 'update', files
else
.packed()
null
packed: () ->
= true
= .errors
t = SW.stop 'packer'
l = .length
Log.info 'packer', 'ready', t, l
.packed()
null
logErrors: () ->
try
base = .base
if .length
for error in
error.type = 'packer'
Log.error , base
catch e
console.log 'packing error: ', e.toString()
null
exit: () ->
.exit()
null
module.exports = Packer