make writeBundle() return a readable stream instead of piping to output itself.
fixed some DRY violations wrt /js/bundle.js.