tokens-replace

1.0.2 • Public • Published

Replace loader for Webpack

Perform replacements (plain and regular expression) in the contents loaded by the loader.

(PT-BR) Fork apenas modificado devido a versão do loader-utils Utilizado para substituir tokens dentro de um app.

Install:

$ npm install --save-dev tokens-replace

Usage:

Add the loader to your webpack.config.js:

Single replacement:

module.exports = {
    // ...
    module: {
      loaders: [
        {
          test: /fileInWhichJQueryIsUndefined\.js$/,
          loader: 'tokens-replace',
          query: {
            search: 'jQuery',
            replace: 'window.$'
          }
        }
      ]
    }
}

Multiple replacements at once:

module.exports = {
    // ...
    module: {
      loaders: [
        {
          test: /\.js$/,
          loader: 'tokens-replace',
          query: {
            replace: [{
              from: 'jQuery',
              to: 'window.$'
            }]
          }
        }
      ]
    }
}

Contributing:

Feel free to open issues to propose stuff and participate. Pull requests are also welcome.

Licence:

MIT

Package Sidebar

Install

npm i tokens-replace

Weekly Downloads

2

Version

1.0.2

License

MIT

Last publish

Collaborators

  • alansousa