1.0.4 • Published 4 years ago

script-timestamp-webpack-plugin v1.0.4

Weekly downloads
4
License
ISC
Repository
github
Last release
4 years ago

一、插件介绍

script-timestamp-webpack-plugin 是 Webpack 一款插件,用来在 Webpack 打包项目后生成的 index.html 文件中,为生成 js 文件的添加时间戳。

实现效果:

script-timestamp-webpack-plugin

二、运行机制

script-timestamp-webpack-plugin运行机制

三、插件使用

1. 安装

npm install script-timestamp-webpack-plugin --save-dev

2. 使用

在模版文件中,添加脚本插入入口:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>hello script-timestamp-webpack-plugin!</title>
</head>
<body>
    <!--script-timestamp-webpack-plugin inset script-->
</body>
</html>

script-timestamp-webpack-plugin

引入插件,并实例化:

// webpack.config.js

const ScriptTimestampWebpackPlugin = require("script-timestamp-webpack-plugin");
module.exports = {
  // ... 省略其他配置
  plugins: [
    // ... 省略其他插件
    new ScriptTimestampWebpackPlugin()  
  ]
}

三、Vuejs 使用

// vue.config.js

const ScriptTimestampWebpackPlugin = require("script-timestamp-webpack-plugin");
module.exports = {
  // ... 省略其他配置
  configureWebpack: {
    plugins: [
      // ... 省略其他插件
      new ScriptTimestampWebpackPlugin()  
    ]
  }
}

四、其他

React Angular 等,使用方法类似~~

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago