Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Welch committed Mar 30, 2020
2 parents 8d724c5 + 7819649 commit 06e0f28
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# SaveRemoteFilePlugin webpack plugin Changelog

## 1.1.0 - 2020-03-29
### Added
* Added 'hash' option to specify whether the plugin adds content hashes to output filenames.

## 1.0.2 - 2018-10-22
### Changed
* Code and docs cleanup
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ This would emit `js/analytics.45eff9ff7d6c7c1e3c3d4184fdbbed90.js` and in your `

You can pass in either an object, or an array of objects for downloading multiple files.

* **url** remote URL of the remote file to save locally
* **filepath** filename where the file will be saved, relative to your webpack `output.path`
* **url** - remote URL of the remote file to save locally
* **filepath** - filename where the file will be saved, relative to your webpack `output.path`
* **hash** - [boolean] whether to add a content hash to the output filename. (default: `true`)
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = function () {
var reportProgress = context && context.reportProgress;
download(option.url).then(function (data) {
var hash = crypto.createHash('md5').update(data).digest("hex");
var newPath = _this.appendHashToPath(option.filepath, hash);
var newPath = option.hash === false ? option.filepath : _this.appendHashToPath(option.filepath, hash);
compilation.assets[newPath] = {
size: function size() {
return data.length;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "save-remote-file-webpack-plugin",
"version": "1.0.2",
"version": "1.1.0",
"description": "webpack 4 plugin to download & save remote files locally",
"main": "dist/index.js",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = class SaveRemoteFilePlugin {
const reportProgress = context && context.reportProgress;
download(option.url).then(data => {
const hash = crypto.createHash('md5').update(data).digest("hex");
const newPath = this.appendHashToPath(option.filepath, hash);
const newPath = (option.hash === false) ? option.filepath : this.appendHashToPath(option.filepath, hash);
compilation.assets[newPath] = {
size: () => data.length,
source: () => data
Expand Down

0 comments on commit 06e0f28

Please sign in to comment.