@tideworthy/tidysites 0.1.12 → 0.1.13
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/README.md +1 -1
- package/bin/tidysites.mjs +2 -0
- package/lib/fetch.mjs +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ nothing else; it lives in `.tidysites/key`, which is kept out of git.
|
|
|
30
30
|
| `tidysites page <path> [--html]` | the rendered page, section by section, with the key each section carries |
|
|
31
31
|
| `tidysites schema [type or collection]` | the section types and layouts, or one type's or collection's fields |
|
|
32
32
|
| `tidysites gallery [type]` | a screenshot of every section type and layout in this website's theme, or the first screen of one type |
|
|
33
|
-
| `tidysites fetch <url> [--out dir]` | a page of the site being ported: cleaned HTML, its outline (headings, navigation, images, phones, fonts, the stylesheet's own variables and colours) and its stylesheets, inline style blocks included |
|
|
33
|
+
| `tidysites fetch <url> [--out dir]` | a page of the site being ported: cleaned HTML, its outline (headings, navigation, images, phones, fonts, an Adobe Fonts kit and the families it serves, the stylesheet's own variables and colours) and its stylesheets, inline style blocks included |
|
|
34
34
|
| `tidysites rm <collection>/<slug> ...` | delete entry files with their sidecars (`services/*` for every entry of a collection); `push --prune` then removes them from the website |
|
|
35
35
|
| `tidysites publish --yes` | the live site becomes a copy of the preview site. A website that is live on the client's own domain is never published from the command line: the website refuses and says so; the person publishes it (Publish now on the Website tab), or an assistant with them does through the connector after they confirm |
|
|
36
36
|
|
package/bin/tidysites.mjs
CHANGED
|
@@ -569,6 +569,8 @@ async function fetchCmd(ctx) {
|
|
|
569
569
|
const css = await r.text();
|
|
570
570
|
cssTexts.push(css);
|
|
571
571
|
writeFileSync(join(outDir, `${base}-${cssTexts.length}.css`), css);
|
|
572
|
+
// The kit's CSS names the families it serves, which the page's HTML does not.
|
|
573
|
+
if (/use\.typekit\.net/i.test(href)) o.adobe_families = [...new Set([...o.adobe_families ?? [], ...[...css.matchAll(/font-family\s*:\s*["']([^"';]+)["']/gi)].map((m) => m[1])])];
|
|
572
574
|
}
|
|
573
575
|
} catch {
|
|
574
576
|
/* a stylesheet that will not download is not the port's problem */
|
package/lib/fetch.mjs
CHANGED
|
@@ -105,6 +105,9 @@ export function outline(html, base) {
|
|
|
105
105
|
out.fonts.push(...fams);
|
|
106
106
|
}
|
|
107
107
|
out.fonts = [...new Set(out.fonts)];
|
|
108
|
+
// Adobe Fonts (Typekit) kits belong to the old site or its builder, so a port cannot load them; the families are named from the kit's CSS by the fetch command.
|
|
109
|
+
out.adobe_kits = [...new Set([...html.matchAll(/use\.typekit\.net\/([a-z0-9]+)\.css/gi)].map((m) => m[1].toLowerCase()))];
|
|
110
|
+
out.adobe_families = [];
|
|
108
111
|
return out;
|
|
109
112
|
}
|
|
110
113
|
|
|
@@ -162,6 +165,10 @@ export function outlineText(o) {
|
|
|
162
165
|
if (o.phones.length) lines.push('', `Phones: ${o.phones.join(', ')}`);
|
|
163
166
|
if (o.emails.length) lines.push(`Emails: ${o.emails.join(', ')}`);
|
|
164
167
|
if (o.fonts.length) lines.push(`Google fonts: ${o.fonts.join(', ')}`);
|
|
168
|
+
if (o.adobe_kits?.length) {
|
|
169
|
+
lines.push(`Adobe Fonts kit: ${o.adobe_kits.join(', ')} (the old site's own kit; this site cannot load it)${o.adobe_families?.length ? ` serving ${o.adobe_families.join(', ')}` : ''}.`);
|
|
170
|
+
lines.push(' Each family from it needs a Google Fonts stand-in on the Business record that matches its shape and weights as closely as possible, and the report must name the original and the stand-in. A font is never left unset.');
|
|
171
|
+
}
|
|
165
172
|
if (o.css) {
|
|
166
173
|
const vars = Object.entries(o.css.variables ?? {});
|
|
167
174
|
if (vars.length) { lines.push('', 'Stylesheet variables (the site\'s own names; trust these over the counts below):'); for (const [k, v] of vars.slice(0, 40)) lines.push(` --${k}: ${v}`); }
|
package/package.json
CHANGED