istanbuljs / babel-plugin-istanbul

A babel plugin that adds istanbul instrumentation to ES6 code
BSD 3-Clause "New" or "Revised" License
626 stars 75 forks source link

examples of non-env based configuration #28

Open jbarrus opened 8 years ago

jbarrus commented 8 years ago

It would be nice to have some documentation of using babel without environment based configuration. For gulp users, for example, you might be using babel to do multiple things in a single run and env variables wouldn't make sense.

For example, when used with a the webpack babel loader, you can use the query param to configure babel options:

module: {
  preLoaders: [
    {
      test: /\.js$/, loader: 'babel', exclude: /node_modules/,
      query: {
        plugins: [
          ['istanbul', {
            'exclude': [
              '**/*.spec.js'
            ]
          }]
        ]
      }
    }
  ]
}
bcoe commented 7 years ago

@jbarrus would love some help adding this documentation to the README 👍

bcoe commented 7 years ago

this would be a great first contribution for anyone who's interested in updating docs.