Skip to content

Commit a7133d4

Browse files
committed
chore: update examples
1 parent c9bdee8 commit a7133d4

6 files changed

Lines changed: 56 additions & 36 deletions

File tree

examples/basic/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ The [script.js](script.js) file contains the script that runs posthtml.
1010

1111
```js
1212
// script.js
13-
const fs = require('fs');
14-
const posthtml = require('posthtml');
15-
const { hash } = require('posthtml-hash');
13+
const fs = require("fs");
14+
const posthtml = require("posthtml");
15+
const { hash } = require("posthtml-hash");
1616

17-
const html = fs.readFileSync('./processed/index.html');
17+
const html = fs.readFileSync("./processed/index.html");
1818

1919
posthtml()
2020
.use(
2121
hash({
2222
/* specify the path to the folder relative to this file (script.js) */
23-
path: 'processed'
23+
path: "processed",
2424
})
2525
)
2626
.process(html)
27-
.then(result => {
27+
.then((result) => {
2828
/* overwrite the existing index.html with the processed markup */
29-
fs.writeFileSync('./processed/index.html', result.html);
29+
fs.writeFileSync("./processed/index.html", result.html);
3030
});
3131
```
3232

@@ -35,15 +35,15 @@ posthtml()
3535
Clone the repo and install the dependencies:
3636

3737
```bash
38-
git clone git@github.com:metonym/posthtml-hash.git
38+
git clone git@github.com:posthtml/posthtml-hash.git
3939
cd posthtml-hash/examples/basic
4040
yarn install
4141
```
4242

4343
Run the script:
4444

4545
```bash
46-
yarn posthtml
46+
yarn hash
4747
```
4848

4949
To restore the processed folder to its unprocessed state, run:

examples/basic/original/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
rel="stylesheet"
77
href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,600,600i,700,700i"
88
/>
9-
<link rel="stylesheet" href="stylesheet.css">
9+
<link rel="stylesheet" href="stylesheet.[hash].css">
1010
</head>
1111
<body>
12-
<script src="main.js"></script>
12+
<script src="main.[hash].js"></script>
1313
</body>
1414
</html>
File renamed without changes.

examples/basic/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
"private": true,
66
"scripts": {
77
"clean": "node clean.js",
8-
"posthtml": "node script.js"
8+
"hash": "node script.js"
99
},
1010
"devDependencies": {
11-
"fs-extra": "^8.1.0",
12-
"posthtml": "^0.11.4",
11+
"fs-extra": "^9.0.0",
12+
"posthtml": "^0.13.0",
1313
"posthtml-hash": "../../"
1414
}
1515
}

examples/basic/yarn.lock

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
# yarn lockfile v1
33

44

5+
at-least-node@^1.0.0:
6+
version "1.0.0"
7+
resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2"
8+
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
9+
510
dom-serializer@0:
611
version "0.2.1"
712
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.2.1.tgz#13650c850daffea35d8b626a4cfc4d3a17643fdb"
@@ -45,14 +50,15 @@ entities@^2.0.0:
4550
resolved "https://registry.yarnpkg.com/entities/-/entities-2.0.0.tgz#68d6084cab1b079767540d80e56a39b423e4abf4"
4651
integrity sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==
4752

48-
fs-extra@^8.1.0:
49-
version "8.1.0"
50-
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
51-
integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==
53+
fs-extra@^9.0.0:
54+
version "9.0.0"
55+
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.0.tgz#b6afc31036e247b2466dc99c29ae797d5d4580a3"
56+
integrity sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g==
5257
dependencies:
58+
at-least-node "^1.0.0"
5359
graceful-fs "^4.2.0"
54-
jsonfile "^4.0.0"
55-
universalify "^0.1.0"
60+
jsonfile "^6.0.1"
61+
universalify "^1.0.0"
5662

5763
graceful-fs@^4.1.6, graceful-fs@^4.2.0:
5864
version "4.2.2"
@@ -89,10 +95,12 @@ is-stream@^1.1.0:
8995
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44"
9096
integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ=
9197

92-
jsonfile@^4.0.0:
93-
version "4.0.0"
94-
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
95-
integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=
98+
jsonfile@^6.0.1:
99+
version "6.0.1"
100+
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.0.1.tgz#98966cba214378c8c84b82e085907b40bf614179"
101+
integrity sha512-jR2b5v7d2vIOust+w3wtFKZIfpC2pnRmFAhAC/BuweZFQR8qZzxH1OyrQ10HmdVYiXWkYUqPVsz91cG7EL2FBg==
102+
dependencies:
103+
universalify "^1.0.0"
96104
optionalDependencies:
97105
graceful-fs "^4.1.6"
98106

@@ -102,7 +110,7 @@ object-assign@^4.1.1:
102110
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=
103111

104112
posthtml-hash@../../:
105-
version "0.2.2"
113+
version "1.0.0"
106114
dependencies:
107115
hasha "^5.0.0"
108116
posthtml "^0.12.0"
@@ -115,18 +123,22 @@ posthtml-parser@^0.4.1:
115123
htmlparser2 "^3.9.2"
116124
object-assign "^4.1.1"
117125

126+
posthtml-parser@^0.4.2:
127+
version "0.4.2"
128+
resolved "https://registry.yarnpkg.com/posthtml-parser/-/posthtml-parser-0.4.2.tgz#a132bbdf0cd4bc199d34f322f5c1599385d7c6c1"
129+
integrity sha512-BUIorsYJTvS9UhXxPTzupIztOMVNPa/HtAm9KHni9z6qEfiJ1bpOBL5DfUOL9XAc3XkLIEzBzpph+Zbm4AdRAg==
130+
dependencies:
131+
htmlparser2 "^3.9.2"
132+
118133
posthtml-render@^1.1.5:
119134
version "1.1.5"
120135
resolved "https://registry.yarnpkg.com/posthtml-render/-/posthtml-render-1.1.5.tgz#387934e85438a3de77085fbc7d264efb00bd0e0f"
121136
integrity sha512-yvt54j0zCBHQVEFAuR+yHld8CZrCa/E1Z/OcFNCV1IEWTLVxT8O7nYnM4IIw1CD4r8kaRd3lc42+0lgCKgm87w==
122137

123-
posthtml@^0.11.4:
124-
version "0.11.4"
125-
resolved "https://registry.yarnpkg.com/posthtml/-/posthtml-0.11.4.tgz#26784d005d57d7aea93ab06dda899d59bdf186c7"
126-
integrity sha512-ezlzBkoPoRgh0jkmT1dsM8eT+lr2azyZ546kbda8oHnVnzvyaB3Ywo6UxUz8wPSOkFAAflCxZJhvvpQH1F6qcA==
127-
dependencies:
128-
posthtml-parser "^0.4.1"
129-
posthtml-render "^1.1.5"
138+
posthtml-render@^1.2.2:
139+
version "1.2.2"
140+
resolved "https://registry.yarnpkg.com/posthtml-render/-/posthtml-render-1.2.2.tgz#f554a19ed40d40e2bfc160826b0a91d4a23656cd"
141+
integrity sha512-MbIXTWwAfJ9qET6Zl29UNwJcDJEEz9Zkr5oDhiujitJa7YBJwEpbkX2cmuklCDxubTMoRWpid3q8DrSyGnUUzQ==
130142

131143
posthtml@^0.12.0:
132144
version "0.12.0"
@@ -136,6 +148,14 @@ posthtml@^0.12.0:
136148
posthtml-parser "^0.4.1"
137149
posthtml-render "^1.1.5"
138150

151+
posthtml@^0.13.0:
152+
version "0.13.0"
153+
resolved "https://registry.yarnpkg.com/posthtml/-/posthtml-0.13.0.tgz#164e9be086d32da795c6ee26e4f8f0a931e2d8d8"
154+
integrity sha512-g9KDiHUJZrzeGUfzpSLJ51K/tJrl+QS/zrEEv2MoIyFZyWVGCHDNQva2MVsy4Oqy4jIFRFjNW4oFjMardOqmKQ==
155+
dependencies:
156+
posthtml-parser "^0.4.2"
157+
posthtml-render "^1.2.2"
158+
139159
readable-stream@^3.1.1:
140160
version "3.4.0"
141161
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc"
@@ -162,10 +182,10 @@ type-fest@^0.3.0:
162182
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.3.1.tgz#63d00d204e059474fe5e1b7c011112bbd1dc29e1"
163183
integrity sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==
164184

165-
universalify@^0.1.0:
166-
version "0.1.2"
167-
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
168-
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
185+
universalify@^1.0.0:
186+
version "1.0.0"
187+
resolved "https://registry.yarnpkg.com/universalify/-/universalify-1.0.0.tgz#b61a1da173e8435b2fe3c67d29b9adf8594bd16d"
188+
integrity sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==
169189

170190
util-deprecate@^1.0.1:
171191
version "1.0.2"

0 commit comments

Comments
 (0)