1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-22 01:44:25 +04:00

Add section comments and format HTML for improved readability (#2158)

This commit is contained in:
Paweł Kuna
2025-02-13 22:41:46 +01:00
committed by GitHub
parent 846c48d140
commit eff95dc033
18 changed files with 85 additions and 115 deletions

View File

@@ -0,0 +1,4 @@
---
---
Add section comments and format HTML for improved readability

View File

@@ -25,6 +25,7 @@
"concurrently": "^9.1.2", "concurrently": "^9.1.2",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"glob": "^11.0.1", "glob": "^11.0.1",
"htmlfy": "^0.6.0",
"js-beautify": "^1.15.1", "js-beautify": "^1.15.1",
"nodemon": "^3.1.9", "nodemon": "^3.1.9",
"pnpm": "9.15.4", "pnpm": "9.15.4",
@@ -34,8 +35,8 @@
"rollup": "4.34.4", "rollup": "4.34.4",
"rtlcss": "^4.3.0", "rtlcss": "^4.3.0",
"sass": "1.71.0", "sass": "1.71.0",
"shx": "^0.3.4",
"terser": "^5.38.1", "terser": "^5.38.1",
"turbo": "^2.4.0", "turbo": "^2.4.0"
"shx": "^0.3.4"
} }
} }

7
pnpm-lock.yaml generated
View File

@@ -44,6 +44,9 @@ importers:
glob: glob:
specifier: ^11.0.1 specifier: ^11.0.1
version: 11.0.1 version: 11.0.1
htmlfy:
specifier: ^0.6.0
version: 0.6.0
js-beautify: js-beautify:
specifier: ^1.15.1 specifier: ^1.15.1
version: 1.15.1 version: 1.15.1
@@ -2211,6 +2214,10 @@ packages:
resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==}
dev: true dev: true
/htmlfy@0.6.0:
resolution: {integrity: sha512-EV1RNjYuG6xIxwA8zDjAUQVeS/SsPE0nhFsdjM8ALopS22ZRAcePocdrhKaaV26PYiTkUrKplJuSZkGRN6Y0Rg==}
dev: true
/htmlparser2@7.2.0: /htmlparser2@7.2.0:
resolution: {integrity: sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==} resolution: {integrity: sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==}
dependencies: dependencies:

View File

@@ -590,6 +590,7 @@ export default function (eleventyConfig) {
/** /**
* Transforms * Transforms
*/ */
if (environment !== "development") {
function prettifyHTML(content, outputPath) { function prettifyHTML(content, outputPath) {
return outputPath.endsWith('.html') return outputPath.endsWith('.html')
? content ? content
@@ -600,4 +601,5 @@ export default function (eleventyConfig) {
} }
eleventyConfig.addTransform('htmlformat', prettifyHTML) eleventyConfig.addTransform('htmlformat', prettifyHTML)
}
}; };

View File

@@ -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-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", "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", "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", "svg-optimize": "svgo -f svg/brand --pretty",
"unused-files": "node build/unused-files.mjs", "unused-files": "node build/unused-files.mjs",
"download-images": "node build/download-images.mjs", "download-images": "node build/download-images.mjs",
@@ -55,5 +57,10 @@
"imageoptim-cli": "^3.1.9", "imageoptim-cli": "^3.1.9",
"@11ty/eleventy": "^3.0.0", "@11ty/eleventy": "^3.0.0",
"@repo/banner": "workspace:*" "@repo/banner": "workspace:*"
},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"printWidth": 160
} }
} }

View File

@@ -1,7 +1,7 @@
{% assign person-id = include.person-id | default: 0 %} {% assign person-id = include.person-id | default: 0 %}
{% assign person = people[person-id] %} {% assign person = people[person-id] %}
<a class="card card-link" href="#"> <a class="card card-link" href="#">
<div class="card-cover card-cover-blurred text-center{% if include.blurred %} card-cover-blurred{% endif %}" style="background-image: url({% include "ui/photo.html" id=person-id %})"> <div class="card-cover card-cover-blurred text-center{% if include.blurred %} card-cover-blurred{% endif %}" style="background-image: url({{ page | relative }}/static/photos/{{ photos[person-id].file }})">
{% include "ui/avatar.html" size="xl" person=person thumb=true rounded=true %} {% include "ui/avatar.html" size="xl" person=person thumb=true rounded=true %}
</div> </div>
<div class="card-body text-center"> <div class="card-body text-center">

View File

@@ -1,10 +1,12 @@
<!-- CSS files -->
{% if site.useIconfont %} {% if site.useIconfont %}
<!-- BEGIN ICONFONT STYLES -->
<link href="https://www.unpkg.com/@tabler/icons-webfont@latest/dist/tabler-icons.min.css" rel="stylesheet" /> <link href="https://www.unpkg.com/@tabler/icons-webfont@latest/dist/tabler-icons.min.css" rel="stylesheet" />
<!-- END ICON FONT STYLES -->
{% endif %} {% endif %}
{% if page-libs %} {% if page-libs %}
<!-- BEGIN PAGE LEVEL STYLES -->
{% for lib in libs.css %} {% for lib in libs.css %}
{% if page-libs contains lib[0] %} {% if page-libs contains lib[0] %}
{% for file in lib[1] %} {% for file in lib[1] %}
@@ -12,12 +14,19 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<!-- END PAGE LEVEL STYLES -->
{% endif %} {% endif %}
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="{{ page | relative }}/dist/css/tabler{% if layout-rtl %}.rtl{% endif %}{% if environment != 'development' %}.min{% endif %}.css{% if environment != 'development' %}?{{ 'now' | date: '%s' }}{% endif %}" rel="stylesheet"/> <link href="{{ page | relative }}/dist/css/tabler{% if layout-rtl %}.rtl{% endif %}{% if environment != 'development' %}.min{% endif %}.css{% if environment != 'development' %}?{{ 'now' | date: '%s' }}{% endif %}" rel="stylesheet"/>
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN PLUGINS STYLES -->
{% for plugin in site.tablerCssPlugins %} {% for plugin in site.tablerCssPlugins %}
<link href="{{ page | relative }}/dist/css/{{ plugin }}{% if layout-rtl %}.rtl{% endif %}{% if environment != 'development' %}.min{% endif %}.css{% if environment != 'development' %}?{{ 'now' | date: '%s' }}{% endif %}" rel="stylesheet"/> <link href="{{ page | relative }}/dist/css/{{ plugin }}{% if layout-rtl %}.rtl{% endif %}{% if environment != 'development' %}.min{% endif %}.css{% if environment != 'development' %}?{{ 'now' | date: '%s' }}{% endif %}" rel="stylesheet"/>
{% endfor %} {% endfor %}
<!-- END PLUGINS STYLES -->
<!-- BEGIN DEMO STYLES -->
<link href="{{ page | relative }}/preview/css/demo{% if layout-rtl %}.rtl{% endif %}{% if environment != 'development' %}.min{% endif %}.css{% if environment != 'development' %}?{{ 'now' | date: '%s' }}{% endif %}" rel="stylesheet"/> <link href="{{ page | relative }}/preview/css/demo{% if layout-rtl %}.rtl{% endif %}{% if environment != 'development' %}.min{% endif %}.css{% if environment != 'development' %}?{{ 'now' | date: '%s' }}{% endif %}" rel="stylesheet"/>
<!-- END DEMO STYLES -->

View File

@@ -1,81 +0,0 @@
<div class="debug">
<a href="#" data-debug="dark">Dark mode</a>
<a href="#" data-debug="rtl">RTL mode</a>
<a href="#" data-debug="code">Show cards code</a>
<a href="#" data-debug="folded">Folded sidebar</a>
<a href="#" data-debug="fullscreen">Fullscreen</a>
<a href="#" data-debug="header-sticky">Sticky header</a>
<a href="{{ page | relative }}/pages.html">All pages</a>
</div>
<style>
.card-debug {
position: absolute;
right: 0;
top: 0;
line-height: 1;
font-size: 11px;
display: none;
}
.debug-info {
margin-left: auto;
}
.card-debug a {
display: inline-block;
padding: 2px;
}
.card-debug a:hover {
text-decoration: underline;
}
.debug {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #222;
color: #fff;
padding: .5rem .75rem;
font-size: 12px;
direction: ltr;
text-align: left;
z-index: 3000;
display: flex;
}
.debug a {
color: inherit;
margin-right: 1rem;
}
.debug a[data-debug]:after {
content: "";
margin: 0 0 1px .25rem;
width: 6px;
height: 6px;
display: inline-block;
background: rgba(255, 255, 255, .3);
border-radius: $border-radius-pill;
}
body.show-debug-code .card-debug {
display: block;
}
@media (max-width: 991.98px) {
.debug {
display: none;
}
}
body.show-debug-code a[data-debug="code"]:after,
html[dir="rtl"] a[data-debug="rtl"]:after,
body.theme-dark a[data-debug="dark"]:after,
:fullscreen a[data-debug="fullscreen"]:after,
body.header-sticky a[data-debug="header-sticky"]:after,
body.sidebar-folded a[data-debug="folded"]:after {
background: #5eba00;
}
</style>

View File

@@ -1,3 +1,4 @@
<!-- BEGIN FOOTER -->
<footer class="footer footer-transparent d-print-none"> <footer class="footer footer-transparent d-print-none">
<div class="container-xl"> <div class="container-xl">
<div class="row text-center align-items-center flex-row-reverse"> <div class="row text-center align-items-center flex-row-reverse">
@@ -35,3 +36,5 @@
</div> </div>
</div> </div>
</footer> </footer>
<!-- END FOOTER -->

View File

@@ -1,4 +1,4 @@
<!-- Libs JS --> <!-- BEGIN PAGE LEVEL SCRIPTS -->
{% assign google-maps-key = site.googleMapsDevKey -%} {% assign google-maps-key = site.googleMapsDevKey -%}
{% if environment != 'development' -%} {% if environment != 'development' -%}
{% assign google-maps-key = site.googleMapsKey -%} {% assign google-maps-key = site.googleMapsKey -%}
@@ -13,12 +13,15 @@
{% endif -%} {% endif -%}
{% endfor -%} {% endfor -%}
{% endif -%} {% endif -%}
<!-- END PAGE LEVEL SCRIPTS -->
<!-- Tabler Core --> <!-- BEGIN GLOBAL MANDATORY SCRIPTS -->
<script src="{{ page | relative }}/dist/js/tabler{% if environment != 'development' %}.min{% endif %}.js{% if environment != 'development' %}?{{ 'now' | date: '%s' }}{% endif %}" defer></script> <script src="{{ page | relative }}/dist/js/tabler{% if environment != 'development' %}.min{% endif %}.js{% if environment != 'development' %}?{{ 'now' | date: '%s' }}{% endif %}" defer></script>
<script src="{{ page | relative }}/preview/js/demo{% if environment != 'development' %}.min{% endif %}.js{% if environment != 'development' %}?{{ 'now' | date: '%s' }}{% endif %}" defer></script> <!-- END GLOBAL MANDATORY SCRIPTS -->
<!-- BEGIN DEMO SCRIPTS -->
<script src="{{ page | relative }}/preview/js/demo{% if environment != 'development' %}.min{% endif %}.js{% if environment != 'development' %}?{{ 'now' | date: '%s' }}{% endif %}" defer></script>
<!-- END DEMO SCRIPTS -->
{% for script in site.captured_global.scripts %} {% for script in site.captured_global.scripts %}
{{ script }} {{ script }}

View File

@@ -1,3 +1,4 @@
<!-- BEGIN NAVBAR LOGO -->
{% assign prefix = include.prefix | default: 'navbar' %} {% assign prefix = include.prefix | default: 'navbar' %}
{% assign breakpoint = include.breakpoint | default: 'lg' %} {% assign breakpoint = include.breakpoint | default: 'lg' %}
@@ -33,3 +34,4 @@
{% else %} {% else %}
</a> </a>
{% endif %} {% endif %}
<!-- END NAVBAR LOGO -->

View File

@@ -1,3 +1,4 @@
<!-- BEGIN NAVBAR MENU -->
{% assign current-page = page-menu | default: layout.menu | split: '.' %} {% assign current-page = page-menu | default: layout.menu | split: '.' %}
{% assign hide-icons = include.hide-icons %} {% assign hide-icons = include.hide-icons %}
{% assign icons-count = icons-info.count %} {% assign icons-count = icons-info.count %}
@@ -91,3 +92,4 @@
</li> </li>
{% endcomment %} {% endcomment %}
</ul> </ul>
<!-- END NAVBAR MENU -->

View File

@@ -1,3 +1,5 @@
<!-- BEGIN NAVBAR TOGGLER -->
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"{% if include.target %} data-bs-target="#{{ include.target }}" aria-controls="{{ include.target }}"{% endif %} aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse"{% if include.target %} data-bs-target="#{{ include.target }}" aria-controls="{{ include.target }}"{% endif %} aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<!-- END NAVBAR TOGGLER -->

View File

@@ -1,3 +1,4 @@
<!-- BEGIN PAGE HEADER -->
{% assign page-header = page-header | default: layout.page-header %} {% assign page-header = page-header | default: layout.page-header %}
{% assign description = page-header-description | default: layout.page-header-description %} {% assign description = page-header-description | default: layout.page-header-description %}
{% assign actions = page-header-actions | default: layout.page-header-actions %} {% assign actions = page-header-actions | default: layout.page-header-actions %}
@@ -8,7 +9,6 @@
{% if page-header-file %} {% if page-header-file %}
{% include "layout/headers/{{ page-header-file }}.html" %} {% include "layout/headers/{{ page-header-file }}.html" %}
{% elsif page-header %} {% elsif page-header %}
<!-- Page header -->
<div class="page-header{% if class %} {{ class }}{% endif %} d-print-none{% if layout-navbar-overlap and layout-navbar-dark %} text-white{% endif %}"> <div class="page-header{% if class %} {{ class }}{% endif %} d-print-none{% if layout-navbar-overlap and layout-navbar-dark %} text-white{% endif %}">
<div class="container-xl"> <div class="container-xl">
<div class="row g-2 align-items-center"> <div class="row g-2 align-items-center">
@@ -41,3 +41,4 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
<!-- END PAGE HEADER -->

View File

@@ -1,3 +1,4 @@
<!-- BEGIN MODAL -->
{% assign modal-id = include.modal-id | default: 'simple' %} {% assign modal-id = include.modal-id | default: 'simple' %}
{% assign size = include['size'] %} {% assign size = include['size'] %}
@@ -10,3 +11,4 @@
</div> </div>
</div> </div>
{% endcapture_global %} {% endcapture_global %}
<!-- END MODAL -->

View File

@@ -31,23 +31,23 @@
{% include "layout/css.html" %} {% include "layout/css.html" %}
<!-- BEGIN CUSTOM FONT -->
<style> <style>
@import url('https://rsms.me/inter/inter.css'); @import url('https://rsms.me/inter/inter.css');
</style> </style>
<!-- END CUSTOM FONT -->
</head> </head>
{% assign layout-dark = layout-dark | default: site.layoutDark %} {% assign layout-dark = layout-dark | default: site.layoutDark %}
<body{% if layout.body-class or body-class %} class="{% if layout.body-class %} {{ layout.body-class }}{% endif %}{% if body-class %} {{ body-class }}{% endif %}"{% endif %}> <body{% if layout.body-class or body-class %} class="{% if layout.body-class %} {{ layout.body-class }}{% endif %}{% if body-class %} {{ body-class }}{% endif %}"{% endif %}>
<!-- BEGIN DEMO THEME SCRIPT -->
<script src="{{ page | relative }}/preview/js/demo-theme{% if environment != 'development' %}.min{% endif %}.js{% if environment != 'development' %}?{{ 'now' | date: '%s' }}{% endif %}"></script> <script src="{{ page | relative }}/preview/js/demo-theme{% if environment != 'development' %}.min{% endif %}.js{% if environment != 'development' %}?{{ 'now' | date: '%s' }}{% endif %}"></script>
<!-- END DEMO THEME SCRIPT -->
{{ content }} {{ content }}
{% include "layout/modals-capture.html" %} {% include "layout/modals-capture.html" %}
{% include "layout/js.html" %} {% include "layout/js.html" %}
{% if site.debug and environment == 'development' %}
{% include "layout/debug.html" %}
{% endif %}
</body> </body>
</html> </html>

View File

@@ -6,19 +6,21 @@ layout: base
<div class="page"> <div class="page">
{% if layout-sidebar %} {% if layout-sidebar %}
<!-- Sidebar --> <!-- BEGIN SIDEBAR -->
{% include "layout/sidebar.html" dark=layout-sidebar-dark right=layout-sidebar-right transparent=layout-navbar-transparent breakpoint="lg" %} {% include "layout/sidebar.html" dark=layout-sidebar-dark right=layout-sidebar-right transparent=layout-navbar-transparent breakpoint="lg" %}
<!-- END SIDEBAR -->
{% endif %} {% endif %}
{% unless layout-hide-topbar %} {% unless layout-hide-topbar %}
<!-- Navbar --> <!-- BEGIN NAVBAR -->
{% 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 %} {% 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 %}
<!-- END NAVBAR -->
{% endunless %} {% endunless %}
<div class="page-wrapper{% if layout-wrapper-full %} page-wrapper-full{% endif %}"> <div class="page-wrapper{% if layout-wrapper-full %} page-wrapper-full{% endif %}">
{% include "layout/page-header.html" %} {% include "layout/page-header.html" %}
<!-- Page body --> <!-- BEGIN PAGE BODY -->
<div class="page-body"> <div class="page-body">
{% if layout-wrapper-full %} {% if layout-wrapper-full %}
{{ content }} {{ content }}
@@ -33,6 +35,7 @@ layout: base
{% endif %} {% endif %}
</div> </div>
<!-- END PAGE BODY -->
{% include "layout/footer.html" %} {% include "layout/footer.html" %}
</div> </div>

View File

@@ -1,5 +1,8 @@
{ {
"$schema": "https://turbo.build/schema.json", "$schema": "https://turbo.build/schema.json",
"globalEnv": [
"NODE_ENV"
],
"tasks": { "tasks": {
"build": { "build": {
"dependsOn": [ "dependsOn": [