Skip to content

Commit 734c6c9

Browse files
committed
v1.2.0
1 parent bf2ee4c commit 734c6c9

3 files changed

Lines changed: 31 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
<!-- ## Unreleased -->
99

10+
## [1.2.0](https://github.com/metonym/posthtml-hash/releases/tag/v1.2.0) - 2020-11-25
11+
12+
- Expand attribute matchers (`href`, `src`) to include "content"
13+
- Add optional `transformPath` method to modify matched attribute values for local file resolution
14+
1015
## [1.1.1](https://github.com/metonym/posthtml-hash/releases/tag/v1.1.1) - 2020-07-16
1116

1217
- Update README, add custom hash to the `examples` folder

README.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ By default, the plugin will attempt to hash file names that contain `[hash]`. As
3434
```html
3535
<html>
3636
<head>
37-
<!-- hashed -->
37+
<!-- hashed -->
3838
<link rel="stylesheet" href="style.[hash].css" />
3939

40-
<!-- not hashed -->
40+
<!-- not hashed -->
4141
<link rel="stylesheet" href="reset.css" />
4242
</head>
4343
<body>
44-
<!-- hashed -->
44+
<!-- hashed -->
4545
<script src="src.[hash].js"></script>
4646

47-
<!-- not hashed -->
47+
<!-- not hashed -->
4848
<script src="analytics.js"></script>
4949
</body>
5050
</html>
@@ -145,6 +145,27 @@ Result:
145145
+ <script src="script.b0dcc67f.js"></script>
146146
```
147147

148+
### Remote origin URLs
149+
150+
Input HTML:
151+
152+
```html
153+
<head>
154+
<meta charset="utf-8" />
155+
<!-- We want to hash this image file name and preserve the remote origin URL -->
156+
<meta property="og:image" content="https://example.com/image.[hash].png" />
157+
</head>
158+
```
159+
160+
```js
161+
hash({
162+
transformPath: (filepath) => {
163+
// removes the targeted remote origin URL when looking up the files locally
164+
return filepath.replace("https://example.com/", "");
165+
},
166+
});
167+
```
168+
148169
## Examples
149170

150171
See the [examples folder](examples) for end-to-end use cases.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "posthtml-hash",
3-
"version": "1.1.1",
3+
"version": "1.2.0",
44
"license": "MIT",
55
"description": "PostHTML plugin for hashing static assets",
66
"author": "Eric Liu (https://github.com/metonym)",

0 commit comments

Comments
 (0)