1.0.5 • Published 6 years ago

assets-replace-webpack-plugin v1.0.5

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

#Replace new assets to dist file

  npm i --save-dev assets-replace-webpack-plugin
  yarn add --dev assets-replace-webpack-plugin

webpack.config.js

const AssetsReplaceWebpackPlugin = require('assets-replace-webpack-plugin')

module.exports = {
  entry: 'index.js',
  output: {
    path: __dirname + '/dist',
    filename: 'index_bundle.js'
  },
  plugins: [
    new AssetsReplaceWebpackPlugin([
        'an_abolute_file',
        'an_abolute_file'
    ])
  ]
}

before this plugin work,you file may like:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="{path}/static/main.abchash99.css">
</head>
<body>
    <script src="{path}/static/main.abchash99.js"></script>
</body>
</html>

if new assets is:

  • main.15acb.css
  • main.15acb.js

when plugin works done,file will look like:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="{path}/static/main.15acb.css">
</head>
<body>
    <script src="{path}/static/main.15acb.js"></script>
</body>
</html>

Params

NameTypeDefaultDescription
|{Array}|an array contains absolute file
1.0.5

6 years ago

1.0.4

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago