ForbesLindesay / browserify-middleware

express middleware for browserify, done right
http://browserify.org
MIT License
381 stars 66 forks source link

Return env if it already exists #4

Closed mhart closed 11 years ago

mhart commented 11 years ago

Saves complicated workarounds like:

var mode = process.env.NODE_ENV || 'development'
var env = (mode === 'production' || mode === 'development') ?
  browserify.settings[mode] : browserify.settings.env(mode)
env('transform', ['coffeeify'])

Now can just do:

var env = browserify.settings.env(process.env.NODE_ENV || 'development')
env('transform', ['coffeeify'])
ForbesLindesay commented 11 years ago

Don't forget you can also do browserify.settings('transform', ['coffeeify'])

mhart commented 11 years ago

Oh! Good point - yeah, was overthinking it, we'll use that instead. Oh well, guess this is a nice to have anyway

ForbesLindesay commented 11 years ago

I'd meant to include this feature anyway, it just got lost in the refactoring. There's also no way to globally set cache, minify, gzip or debug since the settings on the local environment override the global one at the moment.

mhart commented 10 years ago

Hmmm, I forgot that you couldn't set any of those settings... Kinda annoying. For now we're just doing browserify.settings.mode = '' before we set things manually.