Skip to content

Plugin to modify build sources prior to being written to the filesystem

Notifications You must be signed in to change notification settings

jdcrensh/modify-assets-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

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');
      }
    })
  ]
}

About

Plugin to modify build sources prior to being written to the filesystem

Resources

Stars

Watchers

Forks

Packages

No packages published