 styleHelper    = require './gulptasks/style'
 concat         = require 'gulp-concat'
 
+Readable       = require('stream').Readable
+
 devMode        = argv.devMode?
 watchMode      = argv.watchMode?
 version        = argv.ver? or 1

      mangle      : yes
      'screw-ie8' : yes


  bant = build b, globals: opts.globals
    .on 'bundle', (bundle) ->
      outfile = path.join opts.outdir, "#{bundle.name}.js"
      fs.writeFile outfile, bundle.source, (err, res) ->
        debug "could not write #{outfile}"  if err
        debug "#{pretty bundle.source.length} written to #{path.basename outfile}"

  b.require(require.resolve('kd.js'), { expose: 'kd' })  unless watchMode



  mapping = {}
  modules.forEach (name) -> mapping[name] = "../#{name}/lib"

  if devMode then opts.browserify.debug = true

  if watchMode
    b = watchify(browserify(xtend(opts.browserify, watchify.args)))
