<commit_before>## Intro
This is a plugin for [webpack](https://github.com/webpack/webpack).<br>
The main aim is to provide a tool to upload js/css files used in html to cdn, and then replace the reference with the corresponding cdn url.<br>

## Environment requirement
node >= 7.4.0<br>

## Install
```
npm install webpack-upload-plugin
```

## Notice
This plugin does not provide a service as uploading to cdn.<br>
In fact, it actually depends on such service.<br>
This plugin is for webpack 3.

## Dependency
`webpack-cdn-plugin` relies on the existence a `cdn` object with an `upload` method described as below.
```typescript
type cdnUrl = string;
interface cdnRes {
  [localPath: string]: cdnUrl
}
// this is what cdn package looks like
interface cdn {
  upload: (localPaths: string[]) => Promise<cdnRes>;
}
```
If typescript syntax is unfamiliar, here is another description in vanilla javascript.
```js
/**
* @param {string[]} localPath: list of paths of local files
* @return Promise: resolved Promise with structure like {localPath: cdnUrl}
*/
function upload(localPath) {
  // code
}
const cdn = {
  upload
}
```

## Usage
In webpack.config.js
```js
const WebpackUploadPlugin = require("webpack-upload-plugin")
const cdn = require("some-cdn-package")
module.exports = {
  plugins: [
      new WebpackUploadPlugin(cdn, {
          src: path.resolve("./"), // where your html file would emit to (with reference to local js/css files)<commit_msg>adjust readme<commit_after>## Intro
This is a plugin for [webpack](https://github.com/webpack/webpack).<br>
The main aim is to provide a tool to upload js/css files used in html to cdn, and then replace the reference with the corresponding cdn url.<br>

## Environment requirement
node >= 7.4.0<br>

## Install
```
npm install webpack-upload-plugin
```

## Notice
This plugin does not provide a service as uploading to cdn.<br>
In fact, it actually depends on such service.<br>
This plugin is for webpack 3.

## Dependency
`webpack-cdn-plugin` relies on the existence a `cdn` object with an `upload` method described as below.
```typescript
type cdnUrl = string;
interface cdnRes {
  [localPath: string]: cdnUrl
}
// this is what cdn package looks like
interface cdn {
  upload: (localPaths: string[]) => Promise<cdnRes>;
}
```
If typescript syntax is unfamiliar, here is another description in vanilla javascript.
```js
/**
* @param {string[]} localPath: list of paths of local files
* @return Promise<cdnRes>: resolved Promise with structure like {localPath: cdnUrl}
*/
function upload(localPath) {
  // code
}
const cdn = {
  upload
}
```

## Usage
In webpack.config.js
```js
const WebpackUploadPlugin = require("webpack-upload-plugin")
const cdn = require("some-cdn-package")
module.exports = {
  plugins: [
      new WebpackUploadPlugin(cdn, {
          src: path.resolve("./"), // where your html file would emit to (with reference to local js/css files)
{'fraction_non_alphanumeric': 0.11675824175824176, 'fraction_numerical': 0.0027472527472527475, 'mean_word_length': 4.2771739130434785, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 20, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4055406', 'n_tokens_mistral': 895, 'n_tokens_neox': 846, 'n_words': 346}