Skip to content

A simple Webpack loader that applies regular expression replacement to a file

License

Notifications You must be signed in to change notification settings

zmeecer/multiple-replace-loader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

multiple-replace-loader

A simple Webpack loader that applies regular expression replacement to a file

Sample config usage the replacement:

  var appPackage = require('./package.json');
  ...
  modules: {
    loaders: [
      {
        test: /\.(html|xml)$/,
        loaders: [
          'file?name=[name].[ext]', 'multiple-replace?' +
          'META_NAME=' + appPackage.name +
          '&META_DESCRIPTION=' + appPackage.description
        ]
      },
  ...
  ...
  modules: {
    loaders: [
      {
        test: /\.(html|xml)$/,
        loaders: [
          'file',
          'multiple-replace?TOKEN=2g43m16a'
        ]
      },
  ...

Options

  • key (like META_NAME) - The regular expression or special label.
  • value - replacement text, for example, from package.json

About

A simple Webpack loader that applies regular expression replacement to a file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%