From 571515c6ba90c9251f584c29fd5bd0e70506f103 Mon Sep 17 00:00:00 2001 From: "Kenneth G. Franqueiro" Date: Thu, 19 Sep 2024 18:29:47 -0400 Subject: [PATCH] Add top-level index.html for dev only (not GH Pages / W3C site) --- .eleventyignore | 3 +- 11ty/CustomLiquid.ts | 2 + eleventy.config.ts | 8 ++++ index.html | 14 ++++++ package-lock.json | 100 +++++++++++++++++++++++++------------------ package.json | 1 + 6 files changed, 86 insertions(+), 42 deletions(-) create mode 100644 index.html diff --git a/.eleventyignore b/.eleventyignore index 59386af4f7..752acaedf1 100644 --- a/.eleventyignore +++ b/.eleventyignore @@ -1,5 +1,6 @@ -*.* +*.md 11ty/ +acknowledgements.html acknowledgements/ conformance-challenges/ guidelines/ diff --git a/11ty/CustomLiquid.ts b/11ty/CustomLiquid.ts index f395f6e470..7e5de46859 100644 --- a/11ty/CustomLiquid.ts +++ b/11ty/CustomLiquid.ts @@ -89,6 +89,8 @@ export class CustomLiquid extends Liquid { const isIndex = indexPattern.test(filepath); const isTechniques = techniquesPattern.test(filepath); const isUnderstanding = understandingPattern.test(filepath); + + if (!isTechniques && !isUnderstanding) return super.parse(html); const $ = flattenDom(html, filepath); diff --git a/eleventy.config.ts b/eleventy.config.ts index e146eb728f..37dd71bdc9 100644 --- a/eleventy.config.ts +++ b/eleventy.config.ts @@ -1,4 +1,5 @@ import compact from "lodash-es/compact"; +import { rimraf } from "rimraf"; import { copyFile } from "fs/promises"; @@ -124,6 +125,7 @@ export default function (eleventyConfig: any) { eleventyConfig.addGlobalData("eleventyComputed", { // permalink determines output structure; see https://www.11ty.dev/docs/permalinks/ permalink: ({ page, isUnderstanding }: GlobalData) => { + if (page.inputPath === "./index.html" && process.env.WCAG_MODE) return false; if (isUnderstanding) { // understanding-metadata.html exists in 2 places; top-level wins in XSLT process if (/\/20\/understanding-metadata/.test(page.inputPath)) return false; @@ -173,6 +175,12 @@ export default function (eleventyConfig: any) { eleventyConfig.addPassthroughCopy("working-examples/**"); + eleventyConfig.on("eleventy.before", async ({ runMode }: EleventyEvent) => { + // Clear the _site folder before publishes to GH Pages or W3C site, + // to avoid inheriting dev-only files from previous runs + if (runMode === "build" && process.env.WCAG_MODE) await rimraf("_site"); + }); + eleventyConfig.on("eleventy.after", async ({ dir }: EleventyEvent) => { // addPassthroughCopy can only map each file once, // but base.css needs to be copied to a 2nd destination diff --git a/index.html b/index.html new file mode 100644 index 0000000000..9fcfa92eb7 --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + Web Content Accessibility Guidelines {{ versionDecimal }} + + +

Web Content Accessibility Guidelines {{ versionDecimal }}

+ + + diff --git a/package-lock.json b/package-lock.json index 54bc11eff8..c237f220d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "liquidjs": "^10.14.0", "lodash-es": "^4.17.21", "mkdirp": "^3.0.1", + "rimraf": "^5.0.10", "tsx": "^4.11.0" }, "devDependencies": { @@ -1741,6 +1742,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -2478,6 +2480,46 @@ "slash": "^1.0.0" } }, + "node_modules/recursive-copy/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/recursive-copy/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/recursive-copy/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/recursive-copy/node_modules/mkdirp": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", @@ -2489,6 +2531,18 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/recursive-copy/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, "node_modules/resolve-pkg-maps": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", @@ -2507,55 +2561,19 @@ } }, "node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz", + "integrity": "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==", "dependencies": { - "glob": "^7.1.3" + "glob": "^10.3.7" }, "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/rimraf/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/rimraf/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" + "rimraf": "dist/esm/bin.mjs" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rimraf/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", diff --git a/package.json b/package.json index 24492fb7e3..d99692156a 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "liquidjs": "^10.14.0", "lodash-es": "^4.17.21", "mkdirp": "^3.0.1", + "rimraf": "^5.0.10", "tsx": "^4.11.0" }, "devDependencies": {