taptapship / wiredep

Wire Bower dependencies to your source code.
MIT License
1.15k stars 142 forks source link

support environment-specific overrides #134

Closed izeau closed 9 years ago

izeau commented 9 years ago

Resolves issue #112 that was previously closed.

The idea is to declare multiple main overrides, in order to support different environments, such as production, development, test, etc.

Use case: I want to use jquery.min.js for my production environment, and jquery.js during development for easier debugging. I can now override main files in my bower.json:

{
  "overrides": {
    "jquery": {
      "main": {
        "development": "jquery.js",
        "production": "jquery.min.js",
      }
    }
  }
}

I understand you didn’t want to modify wiredep’s usage of overrides, but this is a trivial change to the codebase and a huge advantage for developers, so I hope you’ll reconsider your decision. This syntax is used by other libs, such as main-bower-files.

stephenplusplus commented 9 years ago

I appreciate you doing this, but my vote is still no. This library's job is only to be an extension of Bower that speaks its language and adds on a responsibility Bower core doesn't have: automatic file reference injection. It was only after much consideration I let "overrides" in, since it was a necessary band-aid while the Bower community was developing, with a lot of developers not filling out "main" in their bower.json.

The Bower spec says a package can list multiple files as a "main" property, but they also recommend not packaging minified files. I agree with this recommendation, as there are many other tools that exist that will safely minify, as well as concatenate, scripts. If there are use-cases outside of minified vs. non-minified code that you would use this feature for, please let me know.

stephenplusplus commented 9 years ago

// @CWSpear @ruyadorno for opinions

CWSpear commented 9 years ago

I don't really like it either. If you're going through all this effort to create a build script, it's trivial to add minification at this point. In fact, I would highly recommend concatenation and minification.

ruyadorno commented 9 years ago

I'm also with @stephenplusplus and @CWSpear, this does not follow the Bower specs and is much preferable to just use concatenation and minification for your production environment.

@izeau one thing you can do is to maintain your own fork if you really think this is a valuable feature for you/your corporation. I'm doing something similar at: https://github.com/SunGard-Labs/sg-wiredep you might want to take a look at that.

stephenplusplus commented 9 years ago

Thanks again for stepping up to help out @izeau, this is just one we aren't ready for yet :)