deep-fish-pixel / ouput-replace-webpack-plugin

replace output file content webpack plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ouput-replace-webpack-plugin

replace output file content

Install

Install with npm:

$ npm install --save-dev ouput-replace-webpack-plugin

Examples

new OutputReplaceWebpackPlugin({
    file: 'test.json',
    match: /\d+\/\d+\/\d+/g,
    conent: formatDate(new Date(), 'yyyy-MM-dd~hh:mm:ss'),
})

new OutputReplaceWebpackPlugin({
    replaces: [
        {
           file: 'test.json',
           match: /\d+\/\d+\/\d+/g,
           conent: formatDate(new Date(), 'yyyy-MM-dd~hh:mm:ss'), 
        },
        {  
           file: 'test.json',
           match: /(\d+\.\d+\.)(\d+)/g,
           conent: (all, $1, $2) => {
            return `${$1}${$2 + 1}`;
           }, 
        }
    ],
})

About

replace output file content webpack plugin


Languages

Language:JavaScript 100.0%