modify-assets-webpack-plugin

0.1.3 • Public • Published

modify-assets-webpack-plugin

npm

Plugin to modify build sources prior to bundling.

Install

yarn add -D modify-assets-webpack-plugin

Usage Example

const ModifyAssets = require('modify-assets-webpack-plugin');
 
module.exports = {
  // ... webpack config ...
  plugins: [
    new ModifyAssets({
      test: /src\/.*\.js$/, // regex match on file path(s)
      dirname: process.cwd(), // some base path of matched files.
                              // affects what is passed into test regex.
      callback: (filepath, source) => {
        return source.replace(/cat/g, 'dog');
      }
    })
  ]
}

/modify-assets-webpack-plugin/

    Package Sidebar

    Install

    npm i modify-assets-webpack-plugin

    Weekly Downloads

    1

    Version

    0.1.3

    License

    MIT

    Last publish

    Collaborators

    • jdcrensh