From 30569dd481a97a9b986366ac315359844475a11f Mon Sep 17 00:00:00 2001 From: Anthony Loop Date: Fri, 24 Nov 2023 21:22:43 -0800 Subject: [PATCH] refactor css around my aml-css lib --- package-lock.json | 9 ++ package.json | 1 + postcss.config.cjs | 4 +- src/components/Breadcrumbs.astro | 7 +- src/components/Navigation.astro | 9 +- src/components/Tags.astro | 4 +- src/layouts/BaseLayout.astro | 16 ++- styles/_properties.scss | 91 ------------- styles/_vars.scss | 4 - styles/abstract/_properties.scss | 124 ++++++++++++++++++ styles/abstract/_variables.scss | 27 ++++ styles/abstract/functions/_index.scss | 1 + styles/abstract/mixins/_index.scss | 1 + styles/base/_body.scss | 8 ++ styles/base/_code.scss | 5 + styles/{elements => base}/_headings.scss | 2 +- styles/base/_lists.scss | 13 ++ styles/base/_pseudo.scss | 3 + styles/base/_root.scss | 4 + styles/components/_breadcrumbs.scss | 4 +- styles/components/_content.scss | 70 +++++----- styles/components/_copy.scss | 5 +- styles/components/_heading-anchor.scss | 5 - styles/components/_highlight.scss | 3 +- styles/components/_last-updated.scss | 2 +- styles/components/_skip-to-content.scss | 3 +- styles/components/_tags.scss | 17 ++- styles/components/_toc.scss | 6 +- styles/elements/_body.scss | 25 ---- styles/elements/_code.scss | 4 - styles/elements/_forms.scss | 20 --- styles/elements/_images.scss | 4 - styles/elements/_links.scss | 11 -- styles/elements/_lists.scss | 13 -- styles/elements/_paragraphs.scss | 3 - styles/elements/_root.scss | 7 - styles/functions/_em.scss | 12 -- styles/functions/_index.scss | 3 - styles/functions/_rem.scss | 12 -- styles/functions/_strip-unit.scss | 9 -- styles/generic/_reset.scss | 28 ---- styles/{components => layout}/_main.scss | 9 +- .../_nav-container.scss | 3 +- styles/{components => layout}/_nav.scss | 60 ++++----- styles/layout/_site-wrapper.scss | 9 ++ styles/main.scss | 73 +++++++---- styles/objects/_container.scss | 9 ++ styles/overrides/_astro-code.scss | 8 +- styles/pages/.gitkeep | 0 styles/utilities/.gitkeep | 0 styles/utilities/_hidden.scss | 7 - styles/utilities/_visually-hidden.scss | 14 -- styles/vendor/.gitkeep | 0 53 files changed, 386 insertions(+), 405 deletions(-) delete mode 100644 styles/_properties.scss delete mode 100644 styles/_vars.scss create mode 100644 styles/abstract/_properties.scss create mode 100644 styles/abstract/_variables.scss create mode 100644 styles/abstract/functions/_index.scss create mode 100644 styles/abstract/mixins/_index.scss create mode 100644 styles/base/_body.scss create mode 100644 styles/base/_code.scss rename styles/{elements => base}/_headings.scss (88%) create mode 100644 styles/base/_lists.scss create mode 100644 styles/base/_pseudo.scss create mode 100644 styles/base/_root.scss delete mode 100644 styles/components/_heading-anchor.scss delete mode 100644 styles/elements/_body.scss delete mode 100644 styles/elements/_code.scss delete mode 100644 styles/elements/_forms.scss delete mode 100644 styles/elements/_images.scss delete mode 100644 styles/elements/_links.scss delete mode 100644 styles/elements/_lists.scss delete mode 100644 styles/elements/_paragraphs.scss delete mode 100644 styles/elements/_root.scss delete mode 100644 styles/functions/_em.scss delete mode 100644 styles/functions/_index.scss delete mode 100644 styles/functions/_rem.scss delete mode 100644 styles/functions/_strip-unit.scss delete mode 100644 styles/generic/_reset.scss rename styles/{components => layout}/_main.scss (56%) rename styles/{components => layout}/_nav-container.scss (58%) rename styles/{components => layout}/_nav.scss (69%) create mode 100644 styles/layout/_site-wrapper.scss create mode 100644 styles/objects/_container.scss create mode 100644 styles/pages/.gitkeep create mode 100644 styles/utilities/.gitkeep delete mode 100644 styles/utilities/_hidden.scss delete mode 100644 styles/utilities/_visually-hidden.scss create mode 100644 styles/vendor/.gitkeep diff --git a/package-lock.json b/package-lock.json index 3c6b128..7e631ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "aloop-docs", "version": "1.0.0", "dependencies": { + "@amloop/aml-css": "^4.1.1", "@fullhuman/postcss-purgecss": "^5.0.0", "astro": "^3.6.0", "autoprefixer": "^10.4.16", @@ -18,6 +19,14 @@ "sass": "^1.69.4" } }, + "node_modules/@amloop/aml-css": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@amloop/aml-css/-/aml-css-4.1.1.tgz", + "integrity": "sha512-KDyjFePJRgvqVh56B77Z2LPBdb+KAMjHHi2nkp1J4CwuCM/yMtda+/Lt9yyH34M5n48mcdEKWYIdPjC/vFCDCg==", + "bin": { + "aml-css": "bin/aml-css.js" + } + }, "node_modules/@ampproject/remapping": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", diff --git a/package.json b/package.json index 9ca468a..8bcea84 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "astro": "astro" }, "dependencies": { + "@amloop/aml-css": "^4.1.1", "@fullhuman/postcss-purgecss": "^5.0.0", "astro": "^3.6.0", "autoprefixer": "^10.4.16", diff --git a/postcss.config.cjs b/postcss.config.cjs index 89d4c43..2069090 100644 --- a/postcss.config.cjs +++ b/postcss.config.cjs @@ -11,10 +11,10 @@ const purgecssConfig = { extensions: ["astro"], }, ], + variables: true, safelist: [/^(is-|has-|will-|js-)/], }; module.exports = { - // plugins: [require("autoprefixer"), purgecss(purgecssConfig), cssnano()], - plugins: [require("autoprefixer"), cssnano()], + plugins: [require("autoprefixer"), purgecss(purgecssConfig), cssnano()], }; diff --git a/src/components/Breadcrumbs.astro b/src/components/Breadcrumbs.astro index dda79a3..4a064e1 100644 --- a/src/components/Breadcrumbs.astro +++ b/src/components/Breadcrumbs.astro @@ -4,9 +4,13 @@ import getPath from "../util/path"; const path = getPath(Astro.request.url); const { segments } = Astro.props; + +const ariaCurrent = { + "aria-current": "page", +}; --- -