1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-21 17:34: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",
"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"
}
}

7
pnpm-lock.yaml generated
View File

@@ -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:

View File

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

View File

@@ -1,7 +1,7 @@
{% assign person-id = include.person-id | default: 0 %}
{% assign person = people[person-id] %}
<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 %}
</div>
<div class="card-body text-center">

View File

@@ -1,10 +1,12 @@
<!-- CSS files -->
{% if site.useIconfont %}
<!-- BEGIN ICONFONT STYLES -->
<link href="https://www.unpkg.com/@tabler/icons-webfont@latest/dist/tabler-icons.min.css" rel="stylesheet" />
<!-- END ICON FONT STYLES -->
{% endif %}
{% if page-libs %}
<!-- BEGIN PAGE LEVEL STYLES -->
{% for lib in libs.css %}
{% if page-libs contains lib[0] %}
{% for file in lib[1] %}
@@ -12,12 +14,19 @@
{% endfor %}
{% endif %}
{% endfor %}
<!-- END PAGE LEVEL STYLES -->
{% 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"/>
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN PLUGINS STYLES -->
{% 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"/>
{% 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"/>
<!-- 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">
<div class="container-xl">
<div class="row text-center align-items-center flex-row-reverse">
@@ -35,3 +36,5 @@
</div>
</div>
</footer>
<!-- END FOOTER -->

View File

@@ -1,4 +1,4 @@
<!-- Libs JS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
{% assign google-maps-key = site.googleMapsDevKey -%}
{% if environment != 'development' -%}
{% assign google-maps-key = site.googleMapsKey -%}
@@ -13,12 +13,15 @@
{% endif -%}
{% endfor -%}
{% 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 }}/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 %}
{{ script }}

View File

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

View File

@@ -1,3 +1,4 @@
<!-- BEGIN NAVBAR MENU -->
{% assign current-page = page-menu | default: layout.menu | split: '.' %}
{% assign hide-icons = include.hide-icons %}
{% assign icons-count = icons-info.count %}
@@ -91,3 +92,4 @@
</li>
{% endcomment %}
</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">
<span class="navbar-toggler-icon"></span>
</button>
<!-- END NAVBAR TOGGLER -->

View File

@@ -1,3 +1,4 @@
<!-- BEGIN PAGE HEADER -->
{% 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 %}
<!-- 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="container-xl">
<div class="row g-2 align-items-center">
@@ -41,3 +41,4 @@
</div>
</div>
{% endif %}
<!-- END PAGE HEADER -->

View File

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

View File

@@ -31,23 +31,23 @@
{% include "layout/css.html" %}
<!-- BEGIN CUSTOM FONT -->
<style>
@import url('https://rsms.me/inter/inter.css');
</style>
<!-- END CUSTOM FONT -->
</head>
{% 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 %}>
<!-- 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>
<!-- END DEMO THEME SCRIPT -->
{{ content }}
{% include "layout/modals-capture.html" %}
{% include "layout/js.html" %}
{% if site.debug and environment == 'development' %}
{% include "layout/debug.html" %}
{% endif %}
</body>
</html>

View File

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

View File

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