subfont 6.7.0 → 6.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/lib/subsetFonts.js +8 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
### v6.8.0 (2022-07-28)
|
|
2
|
+
|
|
3
|
+
- [Update assetgraph to ^7.8.1](https://github.com/Munter/subfont/commit/888a97912f98bd937a53b7bec0f39d50ddc96023) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
4
|
+
- [Don't leave stylesheets behind that only contain comments after removing @font-face rules from them https:\/\/github.com\/Munter\/subfont\/issues\/160\#issuecomment-1194672752](https://github.com/Munter/subfont/commit/3dfd9dfbbe5071b94eb52ac216796bc7c0554078) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
|
5
|
+
|
|
1
6
|
### v6.7.0 (2022-07-24)
|
|
2
7
|
|
|
3
8
|
- [Update subset-font to ^1.5.0](https://github.com/Munter/subfont/commit/ba79ef6db81cedfd0e52672b530ca3afddd68a94) ([Andreas Lind](mailto:andreaslindpetersen@gmail.com))
|
package/lib/subsetFonts.js
CHANGED
|
@@ -568,6 +568,12 @@ function getCodepoints(text) {
|
|
|
568
568
|
return codepoints;
|
|
569
569
|
}
|
|
570
570
|
|
|
571
|
+
function cssAssetIsEmpty(cssAsset) {
|
|
572
|
+
return cssAsset.parseTree.nodes.every(
|
|
573
|
+
(node) => node.type === 'comment' && !node.text.startsWith('!')
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
|
|
571
577
|
async function subsetFonts(
|
|
572
578
|
assetGraph,
|
|
573
579
|
{
|
|
@@ -1252,8 +1258,9 @@ These glyphs are used on your site, but they don't exist in the font you applied
|
|
|
1252
1258
|
cssAsset.markDirty();
|
|
1253
1259
|
maybeEmptyCssAssets.add(cssAsset);
|
|
1254
1260
|
}
|
|
1261
|
+
|
|
1255
1262
|
for (const cssAsset of maybeEmptyCssAssets) {
|
|
1256
|
-
if (cssAsset
|
|
1263
|
+
if (cssAssetIsEmpty(cssAsset)) {
|
|
1257
1264
|
for (const incomingRelation of cssAsset.incomingRelations) {
|
|
1258
1265
|
incomingRelation.detach();
|
|
1259
1266
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "subfont",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.0",
|
|
4
4
|
"description": "Speeds up your pages initial paint by automatically subsetting local or Google fonts and loading them optimally",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=10.0.0"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"homepage": "https://github.com/Munter/subfont#readme",
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@gustavnikolaj/async-main-wrap": "^3.0.1",
|
|
50
|
-
"assetgraph": "^7.
|
|
50
|
+
"assetgraph": "^7.8.1",
|
|
51
51
|
"browserslist": "^4.13.0",
|
|
52
52
|
"css-font-parser": "^0.3.0",
|
|
53
53
|
"css-font-weight-names": "^0.2.1",
|