 SPRITESMITH_ALGORITHM       = 'binary-tree'
 SPRITESMITH_PADDING         = 5
 SPRITESMITH_CSS_NAME_PREFIX = 'sprite@'
-SPRITE_TMPDIR               = '.sprites'
+SPRITES_TMPDIR              = '.sprites'
 STYLES_KDJS_MODULE_NAME     = 'kd.js'
 STYLES_KDJS_CSS_FILE        = 'dist/kd.css'
-STYLES_APPFN_FILE           = 'app/lib/styl/appfn.styl'
+STYLES_COMMONS_GLOB         = 'app/lib/styl/commons/*.styl'
+STYLES_EXTENSION            = 'styl'
 
 module.exports =
 

        w.on 'change', ->
          copyKd()

    xbundle = ->
      opts_ =
        use: nib()
        compress: yes  unless opts.debugCss
        import: includes
        sourcemap: inline: yes  if opts.debugCss

    styl = (x, dir) ->

    bundle = (x)->
      start = Date.now()

      x.styles.forEach (basename) ->
        dir = path.join x.basedir, basename
        styl x, dir

        if opts.watchStyles
          w = chokidar.watch dir, persistent: yes
          w.on 'ready', ->
            w.on 'raw', (e, file) ->
              if e is 'modified' or e is 'deleted'
                console.log e + ' ' + file
                styl x, dir

    init = ->
      copyKd ->
        manifests.forEach (x) ->
          return  unless Array.isArray x.styles
          #bundle x

    if opts.sprites
      @on '_updated-sprites', ->
        init()
    else
      init()

    timeEnd = @_timeEnd.bind this
    notify  = @_notify.bind this

    manifests  = opts.manifests
    watchingKd = false

    commons  = path.join opts.basedir, STYLES_COMMONS_GLOB
    includes = [ commons ]

    pending = 0
    start   = 0


    copyKd = (cb) ->
      kdPath = path.dirname require.resolve STYLES_KDJS_MODULE_NAME
