diff --git a/.changeset/unlucky-sloths-tie.md b/.changeset/unlucky-sloths-tie.md new file mode 100644 index 000000000..6c4bc98dc --- /dev/null +++ b/.changeset/unlucky-sloths-tie.md @@ -0,0 +1,4 @@ +--- +--- + +Add section comments and format HTML for improved readability diff --git a/package.json b/package.json index 4ddef7470..960523e8b 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "concurrently": "^9.1.2", "cross-env": "^7.0.3", "glob": "^11.0.1", + "htmlfy": "^0.6.0", "js-beautify": "^1.15.1", "nodemon": "^3.1.9", "pnpm": "9.15.4", @@ -34,8 +35,8 @@ "rollup": "4.34.4", "rtlcss": "^4.3.0", "sass": "1.71.0", + "shx": "^0.3.4", "terser": "^5.38.1", - "turbo": "^2.4.0", - "shx": "^0.3.4" + "turbo": "^2.4.0" } } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 366fb6024..967588fb6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -44,6 +44,9 @@ importers: glob: specifier: ^11.0.1 version: 11.0.1 + htmlfy: + specifier: ^0.6.0 + version: 0.6.0 js-beautify: specifier: ^1.15.1 version: 1.15.1 @@ -2211,6 +2214,10 @@ packages: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} dev: true + /htmlfy@0.6.0: + resolution: {integrity: sha512-EV1RNjYuG6xIxwA8zDjAUQVeS/SsPE0nhFsdjM8ALopS22ZRAcePocdrhKaaV26PYiTkUrKplJuSZkGRN6Y0Rg==} + dev: true + /htmlparser2@7.2.0: resolution: {integrity: sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==} dependencies: diff --git a/preview/eleventy.config.mjs b/preview/eleventy.config.mjs index 4ddba3208..6cf9a8862 100644 --- a/preview/eleventy.config.mjs +++ b/preview/eleventy.config.mjs @@ -590,14 +590,16 @@ export default function (eleventyConfig) { /** * Transforms */ - function prettifyHTML(content, outputPath) { - return outputPath.endsWith('.html') - ? content - .replace(/\/\/ @formatter:(on|off)\n+/gm, '') - // remove empty lines - .replace(/^\s*[\r\n]/gm, '') - : content - } + if (environment !== "development") { + function prettifyHTML(content, outputPath) { + return outputPath.endsWith('.html') + ? content + .replace(/\/\/ @formatter:(on|off)\n+/gm, '') + // remove empty lines + .replace(/^\s*[\r\n]/gm, '') + : content + } - eleventyConfig.addTransform('htmlformat', prettifyHTML) + eleventyConfig.addTransform('htmlformat', prettifyHTML) + } }; \ No newline at end of file diff --git a/preview/package.json b/preview/package.json index 26ecfa445..cbae03ea0 100644 --- a/preview/package.json +++ b/preview/package.json @@ -18,7 +18,9 @@ "js-minify-demo": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/preview/js/demo.js.map,includeSources,url=demo.min.js.map\" --output dist/preview/js/demo.min.js dist/preview/js/demo.js", "js-minify-theme": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/preview/js/demo-theme.js.map,includeSources,url=demo-theme.min.js.map\" --output dist/preview/js/demo-theme.min.js dist/preview/js/demo-theme.js", "clean": "shx rm -rf dist demo", - "html": "eleventy", + "html": "pnpm run html-build && pnpm run html-prettify", + "html-build": "eleventy", + "html-prettify": "prettier --write \"dist/**/*.html\"", "svg-optimize": "svgo -f svg/brand --pretty", "unused-files": "node build/unused-files.mjs", "download-images": "node build/download-images.mjs", @@ -55,5 +57,10 @@ "imageoptim-cli": "^3.1.9", "@11ty/eleventy": "^3.0.0", "@repo/banner": "workspace:*" + }, + "prettier": { + "tabWidth": 2, + "useTabs": false, + "printWidth": 160 } } \ No newline at end of file diff --git a/preview/pages/_includes/cards/user-card-bg.html b/preview/pages/_includes/cards/user-card-bg.html index d65f90539..ed7739e1e 100644 --- a/preview/pages/_includes/cards/user-card-bg.html +++ b/preview/pages/_includes/cards/user-card-bg.html @@ -1,7 +1,7 @@ {% assign person-id = include.person-id | default: 0 %} {% assign person = people[person-id] %} -
+
{% include "ui/avatar.html" size="xl" person=person thumb=true rounded=true %}
diff --git a/preview/pages/_includes/layout/css.html b/preview/pages/_includes/layout/css.html index 071c3c1bc..462cd092c 100644 --- a/preview/pages/_includes/layout/css.html +++ b/preview/pages/_includes/layout/css.html @@ -1,10 +1,12 @@ - {% if site.useIconfont %} + + {% endif %} {% if page-libs %} + {% for lib in libs.css %} {% if page-libs contains lib[0] %} {% for file in lib[1] %} @@ -12,12 +14,19 @@ {% endfor %} {% endif %} {% endfor %} + {% endif %} + + + {% for plugin in site.tablerCssPlugins %} {% endfor %} + - \ No newline at end of file + + + \ No newline at end of file diff --git a/preview/pages/_includes/layout/debug.html b/preview/pages/_includes/layout/debug.html deleted file mode 100644 index 2d497c41a..000000000 --- a/preview/pages/_includes/layout/debug.html +++ /dev/null @@ -1,81 +0,0 @@ - - diff --git a/preview/pages/_includes/layout/footer.html b/preview/pages/_includes/layout/footer.html index 445b951db..633113d56 100644 --- a/preview/pages/_includes/layout/footer.html +++ b/preview/pages/_includes/layout/footer.html @@ -1,3 +1,4 @@ +
@@ -34,4 +35,6 @@
- \ No newline at end of file + + + \ No newline at end of file diff --git a/preview/pages/_includes/layout/js.html b/preview/pages/_includes/layout/js.html index 9a24e51e7..08a799fc2 100644 --- a/preview/pages/_includes/layout/js.html +++ b/preview/pages/_includes/layout/js.html @@ -1,4 +1,4 @@ - + {% assign google-maps-key = site.googleMapsDevKey -%} {% if environment != 'development' -%} {% assign google-maps-key = site.googleMapsKey -%} @@ -13,12 +13,15 @@ {% endif -%} {% endfor -%} {% endif -%} + - - + - + + + + {% for script in site.captured_global.scripts %} {{ script }} diff --git a/preview/pages/_includes/layout/navbar-logo.html b/preview/pages/_includes/layout/navbar-logo.html index dcc9efa76..d4c193ba8 100644 --- a/preview/pages/_includes/layout/navbar-logo.html +++ b/preview/pages/_includes/layout/navbar-logo.html @@ -1,3 +1,4 @@ + {% assign prefix = include.prefix | default: 'navbar' %} {% assign breakpoint = include.breakpoint | default: 'lg' %} @@ -32,4 +33,5 @@
{% else %} -{% endif %} \ No newline at end of file +{% endif %} + \ No newline at end of file diff --git a/preview/pages/_includes/layout/navbar-menu.html b/preview/pages/_includes/layout/navbar-menu.html index b5d1125f7..01bd871c0 100644 --- a/preview/pages/_includes/layout/navbar-menu.html +++ b/preview/pages/_includes/layout/navbar-menu.html @@ -1,3 +1,4 @@ + {% assign current-page = page-menu | default: layout.menu | split: '.' %} {% assign hide-icons = include.hide-icons %} {% assign icons-count = icons-info.count %} @@ -90,4 +91,5 @@ {% endcomment %} - \ No newline at end of file + + \ No newline at end of file diff --git a/preview/pages/_includes/layout/navbar-toggler.html b/preview/pages/_includes/layout/navbar-toggler.html index 3c547cc1e..6cf5a3669 100644 --- a/preview/pages/_includes/layout/navbar-toggler.html +++ b/preview/pages/_includes/layout/navbar-toggler.html @@ -1,3 +1,5 @@ + \ No newline at end of file + + \ No newline at end of file diff --git a/preview/pages/_includes/layout/page-header.html b/preview/pages/_includes/layout/page-header.html index b83cfb571..3e538efa5 100644 --- a/preview/pages/_includes/layout/page-header.html +++ b/preview/pages/_includes/layout/page-header.html @@ -1,3 +1,4 @@ + {% assign page-header = page-header | default: layout.page-header %} {% assign description = page-header-description | default: layout.page-header-description %} {% assign actions = page-header-actions | default: layout.page-header-actions %} @@ -8,7 +9,6 @@ {% if page-header-file %} {% include "layout/headers/{{ page-header-file }}.html" %} {% elsif page-header %} -
@@ -40,4 +40,5 @@
-{% endif %} \ No newline at end of file +{% endif %} + \ No newline at end of file diff --git a/preview/pages/_includes/ui/modal.html b/preview/pages/_includes/ui/modal.html index b523feec8..e5c071999 100644 --- a/preview/pages/_includes/ui/modal.html +++ b/preview/pages/_includes/ui/modal.html @@ -1,3 +1,4 @@ + {% assign modal-id = include.modal-id | default: 'simple' %} {% assign size = include['size'] %} @@ -9,4 +10,5 @@ -{% endcapture_global %} \ No newline at end of file +{% endcapture_global %} + \ No newline at end of file diff --git a/preview/pages/_layouts/base.html b/preview/pages/_layouts/base.html index 55846f3e5..4e6fa5eec 100644 --- a/preview/pages/_layouts/base.html +++ b/preview/pages/_layouts/base.html @@ -31,23 +31,23 @@ {% include "layout/css.html" %} + + {% assign layout-dark = layout-dark | default: site.layoutDark %} - + + + {{ content }} {% include "layout/modals-capture.html" %} {% include "layout/js.html" %} - - {% if site.debug and environment == 'development' %} - {% include "layout/debug.html" %} - {% endif %} diff --git a/preview/pages/_layouts/default.html b/preview/pages/_layouts/default.html index 174b15109..6001e74a2 100644 --- a/preview/pages/_layouts/default.html +++ b/preview/pages/_layouts/default.html @@ -6,19 +6,21 @@ layout: base
{% if layout-sidebar %} - + {% include "layout/sidebar.html" dark=layout-sidebar-dark right=layout-sidebar-right transparent=layout-navbar-transparent breakpoint="lg" %} + {% endif %} {% unless layout-hide-topbar %} - + {% include "layout/navbar.html" condensed=layout-navbar-condensed overlap=layout-navbar-overlap dark=layout-navbar-dark hide-brand=layout-navbar-hide-brand hide-menu=layout-navbar-hide-menu sticky=layout-navbar-sticky transparent=layout-topbar-transparent class=layout-navbar-class %} + {% endunless %}
{% include "layout/page-header.html" %} - +
{% if layout-wrapper-full %} {{ content }} @@ -33,6 +35,7 @@ layout: base {% endif %}
+ {% include "layout/footer.html" %}
diff --git a/turbo.json b/turbo.json index 32bf50ca6..27e874558 100644 --- a/turbo.json +++ b/turbo.json @@ -1,5 +1,8 @@ { "$schema": "https://turbo.build/schema.json", + "globalEnv": [ + "NODE_ENV" + ], "tasks": { "build": { "dependsOn": [