Skip to content

Commit 5c7303b

Browse files
authored
feat: add hx- prefix to Hextra Tailwind CSS classes (#300)
* feat: add prefix to tailwind css classes * fix: remove unnecessary prefixes * fix: add missing prefix in other places * chore: regenerate hugo_stats.json * chore: run `npm run build:css` * chore: add `hx-` prefix to _index.fa.md * fix: lang switcher display issue * fix: add `hx-` prefix to showcase/index.fa.md * fix: lang switch param mistake
1 parent 0e312d3 commit 5c7303b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1335
-1340
lines changed

assets/css/compiled/main.css

+500-506
Large diffs are not rendered by default.

assets/css/components/code-copy.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
(-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))
33
) {
44
.code-copy-btn {
5-
@apply backdrop-blur-md bg-opacity-[.85] dark:bg-opacity-80;
5+
@apply hx-backdrop-blur-md hx-bg-opacity-[.85] dark:hx-bg-opacity-80;
66
}
77
}

assets/css/components/navbar.css

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
nav {
22
.search-wrapper {
3-
@apply hidden md:inline-block;
3+
@apply hx-hidden md:hx-inline-block;
44
}
55
}
66

77
@supports (
88
(-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))
99
) {
1010
.nav-container-blur {
11-
@apply backdrop-blur-md bg-white/[.85] dark:!bg-dark/80;
11+
@apply hx-backdrop-blur-md hx-bg-white/[.85] dark:!hx-bg-dark/80;
1212
}
1313
}
1414

1515
.hamburger-menu svg {
1616
g {
17-
@apply origin-center;
17+
@apply hx-origin-center;
1818
transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
1919
}
2020
path {
@@ -37,16 +37,16 @@ nav {
3737

3838
&.open > {
3939
path {
40-
@apply opacity-0;
40+
@apply hx-opacity-0;
4141
}
4242
g:nth-of-type(1) {
43-
@apply rotate-45;
43+
@apply hx-rotate-45;
4444
path {
4545
transform: translate3d(0, 4px, 0);
4646
}
4747
}
4848
g:nth-of-type(2) {
49-
@apply -rotate-45;
49+
@apply -hx-rotate-45;
5050
path {
5151
transform: translate3d(0, -4px, 0);
5252
}

assets/css/components/scrollbar.css

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44

55
scrollbar-gutter: stable;
66
&::-webkit-scrollbar {
7-
@apply w-3 h-3;
7+
@apply hx-w-3 hx-h-3;
88
}
99
&::-webkit-scrollbar-track {
10-
@apply bg-transparent;
10+
@apply hx-bg-transparent;
1111
}
1212
&::-webkit-scrollbar-thumb {
13-
@apply rounded-[10px];
13+
@apply hx-rounded-[10px];
1414
}
1515
&:hover::-webkit-scrollbar-thumb {
1616
border: 3px solid transparent;
1717
background-color: var(--tw-shadow-color);
1818
background-clip: content-box;
19-
@apply shadow-neutral-500/20 hover:shadow-neutral-500/40;
19+
@apply hx-shadow-neutral-500/20 hover:hx-shadow-neutral-500/40;
2020
}
2121
}

assets/css/components/search.css

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
.search-wrapper {
22
li {
3-
@apply mx-2.5 break-words rounded-md contrast-more:border text-gray-800 contrast-more:border-transparent dark:text-gray-300;
3+
@apply hx-mx-2.5 hx-break-words hx-rounded-md contrast-more:hx-border hx-text-gray-800 contrast-more:hx-border-transparent dark:hx-text-gray-300;
44
a {
5-
@apply block scroll-m-12 px-2.5 py-2;
5+
@apply hx-block hx-scroll-m-12 hx-px-2.5 hx-py-2;
66
}
77

88
.title {
9-
@apply text-base font-semibold leading-5;
9+
@apply hx-text-base hx-font-semibold hx-leading-5;
1010
}
1111

1212
.active {
13-
@apply rounded-md bg-primary-500/10 contrast-more:border-primary-500;
13+
@apply hx-rounded-md hx-bg-primary-500/10 contrast-more:hx-border-primary-500;
1414
}
1515
}
1616

1717
.no-result {
18-
@apply block select-none p-8 text-center text-sm text-gray-400;
18+
@apply hx-block hx-select-none hx-p-8 hx-text-center hx-text-sm hx-text-gray-400;
1919
}
2020

2121
.prefix {
22-
@apply mx-2.5 mb-2 mt-6 select-none border-b border-black/10 px-2.5 pb-1.5 text-xs font-semibold
23-
uppercase text-gray-500 first:mt-0 dark:border-white/20 dark:text-gray-300 contrast-more:border-gray-600
24-
contrast-more:text-gray-900 contrast-more:dark:border-gray-50 contrast-more:dark:text-gray-50;
22+
@apply hx-mx-2.5 hx-mb-2 hx-mt-6 hx-select-none hx-border-b hx-border-black/10 hx-px-2.5 hx-pb-1.5 hx-text-xs hx-font-semibold
23+
hx-uppercase hx-text-gray-500 first:hx-mt-0 dark:hx-border-white/20 dark:hx-text-gray-300 contrast-more:hx-border-gray-600
24+
contrast-more:hx-text-gray-900 contrast-more:dark:hx-border-gray-50 contrast-more:dark:hx-text-gray-50;
2525
}
2626

2727
.excerpt {
28-
@apply overflow-hidden text-ellipsis mt-1 text-sm leading-[1.35rem] text-gray-600 dark:text-gray-400 contrast-more:dark:text-gray-50;
28+
@apply hx-overflow-hidden hx-text-ellipsis hx-mt-1 hx-text-sm hx-leading-[1.35rem] hx-text-gray-600 dark:hx-text-gray-400 contrast-more:dark:hx-text-gray-50;
2929
display: -webkit-box;
3030
line-clamp: 1;
3131
-webkit-line-clamp: 1;
3232
-webkit-box-orient: vertical;
3333
}
3434

3535
.match {
36-
@apply text-primary-600;
36+
@apply hx-text-primary-600;
3737
}
3838
}

assets/css/components/sidebar.css

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@media (max-width: 767px) {
22
.sidebar-container {
3-
@apply fixed pt-[calc(var(--navbar-height))] top-0 w-full bottom-0 z-[15] overscroll-contain bg-white dark:bg-dark;
3+
@apply hx-fixed hx-pt-[calc(var(--navbar-height))] hx-top-0 hx-w-full hx-bottom-0 hx-z-[15] hx-overscroll-contain hx-bg-white dark:hx-bg-dark;
44
transition: transform 0.8s cubic-bezier(0.52, 0.16, 0.04, 1);
55
will-change: transform, opacity;
66
contain: layout style;
@@ -10,12 +10,12 @@
1010

1111
.sidebar-container {
1212
li > div {
13-
@apply h-0;
13+
@apply hx-h-0;
1414
}
1515
li.open > div {
16-
@apply h-auto pt-1;
16+
@apply hx-h-auto hx-pt-1;
1717
}
1818
li.open > a > span > svg > path {
19-
@apply rotate-90;
19+
@apply hx-rotate-90;
2020
}
2121
}

assets/css/components/steps.css

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
counter-increment: step;
33

44
&:before {
5-
@apply absolute w-[33px] h-[33px];
6-
@apply border-4 border-white bg-gray-100 dark:border-dark dark:bg-neutral-800;
7-
@apply rounded-full text-neutral-400 text-base font-normal text-center -indent-px;
8-
@apply mt-[3px] ml-[-41px];
5+
@apply hx-absolute hx-w-[33px] hx-h-[33px];
6+
@apply hx-border-4 hx-border-white hx-bg-gray-100 dark:hx-border-dark dark:hx-bg-neutral-800;
7+
@apply hx-rounded-full hx-text-neutral-400 hx-text-base hx-font-normal hx-text-center -hx-indent-px;
8+
@apply hx-mt-[3px] hx-ml-[-41px];
99
content: counter(step);
1010
}
1111
}

assets/css/highlight.css

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,51 @@
33
@import "chroma/dark.css";
44

55
.code-block {
6-
@apply text-[.9em] leading-5;
6+
@apply hx-text-[.9em] hx-leading-5;
77

88
pre {
9-
@apply text-[.9em] bg-primary-700/5 overflow-x-auto font-medium subpixel-antialiased dark:bg-primary-300/10 contrast-more:border contrast-more:border-primary-900/20 contrast-more:contrast-150 contrast-more:dark:border-primary-100/40;
9+
@apply hx-text-[.9em] hx-bg-primary-700/5 hx-overflow-x-auto hx-font-medium hx-subpixel-antialiased dark:hx-bg-primary-300/10 contrast-more:hx-border contrast-more:hx-border-primary-900/20 contrast-more:hx-contrast-150 contrast-more:dark:hx-border-primary-100/40;
1010
}
1111

1212
.filename {
13-
@apply absolute top-0 z-[1] w-full truncate rounded-t-xl bg-primary-700/5 py-2 px-4 text-xs text-gray-700 dark:bg-primary-300/10 dark:text-gray-200;
13+
@apply hx-absolute hx-top-0 hx-z-[1] hx-w-full hx-truncate hx-rounded-t-xl hx-bg-primary-700/5 hx-py-2 hx-px-4 hx-text-xs hx-text-gray-700 dark:hx-bg-primary-300/10 dark:hx-text-gray-200;
1414
}
1515

1616
.filename + pre:not(.lntable pre) {
1717
/* Override padding for code blocks with filename but no highlight */
18-
@apply pt-12;
18+
@apply hx-pt-12;
1919
}
2020
}
2121

2222
.code-block pre:not(.lntable pre) {
23-
@apply px-4 mb-4 py-4 rounded-xl;
23+
@apply hx-px-4 hx-mb-4 hx-py-4 hx-rounded-xl;
2424
}
2525

2626
.code-block div:nth-of-type(2) pre {
27-
@apply pt-12 pb-4;
27+
@apply hx-pt-12 hx-pb-4;
2828
}
2929

3030
.chroma {
3131
.lntable {
32-
@apply m-0 block w-auto overflow-auto rounded-xl;
32+
@apply hx-m-0 hx-block hx-w-auto hx-overflow-auto hx-rounded-xl;
3333

3434
pre {
35-
@apply pt-4 pb-4;
35+
@apply hx-pt-4 hx-pb-4;
3636
}
3737
}
3838
.ln,
3939
.lnt:not(.hl > .lnt),
4040
.hl:not(.line) {
41-
@apply pl-4 pr-4 min-w-[2.6rem] text-neutral-600 dark:text-neutral-300;
41+
@apply hx-pl-4 hx-pr-4 hx-min-w-[2.6rem] hx-text-neutral-600 dark:hx-text-neutral-300;
4242
}
4343
.lntd {
44-
@apply p-0 align-top;
44+
@apply hx-p-0 hx-align-top;
4545
}
4646
.lntd:last-of-type {
47-
@apply w-full;
47+
@apply hx-w-full;
4848
}
4949
/* LineHighlight */
5050
.hl {
51-
@apply block w-full bg-primary-800/10;
51+
@apply hx-block hx-w-full hx-bg-primary-800/10;
5252
}
5353
}

assets/css/styles.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
@import "components/code-copy.css";
1212

1313
html {
14-
@apply text-base antialiased;
14+
@apply hx-text-base hx-antialiased;
1515
font-feature-settings: "rlig" 1, "calt" 1, "ss01" 1;
1616
-webkit-tap-highlight-color: transparent;
1717
}
1818

1919
body {
20-
@apply w-full bg-white dark:bg-dark dark:text-gray-100;
20+
@apply hx-w-full hx-bg-white dark:hx-bg-dark dark:hx-text-gray-100;
2121
}
2222

2323
:root {

assets/css/typography.css

+36-36
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,117 @@
11
.content {
22
:where(h1):not(:where([class~=not-prose],[class~=not-prose] *)) {
3-
@apply mt-2 text-4xl font-bold tracking-tight text-slate-900 dark:text-slate-100;
3+
@apply hx-mt-2 hx-text-4xl hx-font-bold hx-tracking-tight hx-text-slate-900 dark:hx-text-slate-100;
44
}
55
:where(h2):not(:where([class~=not-prose],[class~=not-prose] *)) {
6-
@apply font-semibold tracking-tight text-slate-900 dark:text-slate-100 mt-10 border-b pb-1 text-3xl border-neutral-200/70 contrast-more:border-neutral-400 dark:border-primary-100/10 contrast-more:dark:border-neutral-400;
6+
@apply hx-font-semibold hx-tracking-tight hx-text-slate-900 dark:hx-text-slate-100 hx-mt-10 hx-border-b hx-pb-1 hx-text-3xl hx-border-neutral-200/70 contrast-more:hx-border-neutral-400 dark:hx-border-primary-100/10 contrast-more:dark:hx-border-neutral-400;
77
}
88
:where(h3):not(:where([class~=not-prose],[class~=not-prose] *)) {
9-
@apply font-semibold tracking-tight text-slate-900 dark:text-slate-100 mt-8 text-2xl;
9+
@apply hx-font-semibold hx-tracking-tight hx-text-slate-900 dark:hx-text-slate-100 hx-mt-8 hx-text-2xl;
1010
}
1111
:where(h4):not(:where([class~=not-prose],[class~=not-prose] *)) {
12-
@apply font-semibold tracking-tight text-slate-900 dark:text-slate-100 mt-8 text-xl;
12+
@apply hx-font-semibold hx-tracking-tight hx-text-slate-900 dark:hx-text-slate-100 hx-mt-8 hx-text-xl;
1313
}
1414
:where(h5):not(:where([class~=not-prose],[class~=not-prose] *)) {
15-
@apply font-semibold tracking-tight text-slate-900 dark:text-slate-100 mt-8 text-lg;
15+
@apply hx-font-semibold hx-tracking-tight hx-text-slate-900 dark:hx-text-slate-100 hx-mt-8 hx-text-lg;
1616
}
1717
:where(h6):not(:where([class~=not-prose],[class~=not-prose] *)) {
18-
@apply font-semibold tracking-tight text-slate-900 dark:text-slate-100 mt-8 text-base;
18+
@apply hx-font-semibold hx-tracking-tight hx-text-slate-900 dark:hx-text-slate-100 hx-mt-8 hx-text-base;
1919
}
2020
:where(p):not(:where([class~=not-prose],[class~=not-prose] *)) {
21-
@apply mt-6 leading-7 first:mt-0;
21+
@apply hx-mt-6 hx-leading-7 first:hx-mt-0;
2222
}
2323
:where(a):not(:where([class~=not-prose],[class~=not-prose] *)) {
24-
@apply text-primary-600 underline decoration-from-font [text-underline-position:from-font];
24+
@apply hx-text-primary-600 hx-underline hx-decoration-from-font [text-underline-position:from-font];
2525
}
2626
:where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)) {
27-
@apply mt-6 border-gray-300 italic text-gray-700 dark:border-gray-700 dark:text-gray-400 first:mt-0 ltr:border-l-2 ltr:pl-6 rtl:border-r-2 rtl:pr-6;
27+
@apply hx-mt-6 hx-border-gray-300 hx-italic hx-text-gray-700 dark:hx-border-gray-700 dark:hx-text-gray-400 first:hx-mt-0 ltr:hx-border-l-2 ltr:hx-pl-6 rtl:hx-border-r-2 rtl:hx-pr-6;
2828
}
2929
:where(pre):not(:where(.code-block pre, [class~=not-prose],[class~=not-prose] *)) {
30-
@apply bg-primary-700/5 mb-4 overflow-x-auto rounded-xl font-medium subpixel-antialiased dark:bg-primary-300/10 text-[.9em] contrast-more:border contrast-more:border-primary-900/20 contrast-more:contrast-150 contrast-more:dark:border-primary-100/40 py-4;
30+
@apply hx-bg-primary-700/5 hx-mb-4 hx-overflow-x-auto hx-rounded-xl hx-font-medium hx-subpixel-antialiased dark:hx-bg-primary-300/10 hx-text-[.9em] contrast-more:hx-border contrast-more:hx-border-primary-900/20 contrast-more:hx-contrast-150 contrast-more:dark:hx-border-primary-100/40 hx-py-4;
3131
}
3232
:where(code):not(:where(.code-block code, [class~=not-prose],[class~=not-prose] *)) {
33-
@apply border-black border-opacity-[0.04] bg-opacity-[0.03] bg-black break-words rounded-md border py-0.5 px-[.25em] text-[.9em] dark:border-white/10 dark:bg-white/10;
33+
@apply hx-border-black hx-border-opacity-[0.04] hx-bg-opacity-[0.03] hx-bg-black hx-break-words hx-rounded-md hx-border hx-py-0.5 hx-px-[.25em] hx-text-[.9em] dark:hx-border-white/10 dark:hx-bg-white/10;
3434
}
3535
:where(table):not(:where(.code-block table, [class~=not-prose],[class~=not-prose] *)) {
36-
@apply block overflow-x-auto mt-6 p-0 first:mt-0;
36+
@apply hx-block hx-overflow-x-auto hx-mt-6 hx-p-0 first:hx-mt-0;
3737

3838
tr {
39-
@apply m-0 border-t border-gray-300 p-0 dark:border-gray-600 even:bg-gray-100 even:dark:bg-gray-600/20;
39+
@apply hx-m-0 hx-border-t hx-border-gray-300 hx-p-0 dark:hx-border-gray-600 even:hx-bg-gray-100 even:dark:hx-bg-gray-600/20;
4040
}
4141
th {
42-
@apply m-0 border border-gray-300 px-4 py-2 font-semibold dark:border-gray-600;
42+
@apply hx-m-0 hx-border hx-border-gray-300 hx-px-4 hx-py-2 hx-font-semibold dark:hx-border-gray-600;
4343
}
4444
td {
45-
@apply m-0 border border-gray-300 px-4 py-2 dark:border-gray-600;
45+
@apply hx-m-0 hx-border hx-border-gray-300 hx-px-4 hx-py-2 dark:hx-border-gray-600;
4646
}
4747
}
4848
:where(ol):not(:where([class~=not-prose],[class~=not-prose] *)) {
49-
@apply mt-6 list-decimal first:mt-0 ltr:ml-6 rtl:mr-6;
49+
@apply hx-mt-6 hx-list-decimal first:hx-mt-0 ltr:hx-ml-6 rtl:hx-mr-6;
5050
li {
51-
@apply my-2;
51+
@apply hx-my-2;
5252
}
5353
}
5454
:where(ul):not(:where([class~=not-prose],[class~=not-prose] *)) {
55-
@apply mt-6 list-disc first:mt-0 ltr:ml-6 rtl:mr-6;
55+
@apply hx-mt-6 hx-list-disc first:hx-mt-0 ltr:hx-ml-6 rtl:hx-mr-6;
5656
li {
57-
@apply my-2;
57+
@apply hx-my-2;
5858
}
5959
}
60-
/* This CSS rule targets the first nested unordered (ul) or ordered (ol) list
61-
inside the list item (li) of any parent ul or ol.
60+
/* This CSS rule targets the first nested unordered (ul) or ordered (ol) list
61+
inside the list item (li) of any parent ul or ol.
6262
The rule sets the top margin of the selected list to zero. */
6363
:where(ul, ol) > li > :where(ul, ol):not(:where([class~=not-prose],[class~=not-prose] *)) {
64-
@apply mt-0;
64+
@apply hx-mt-0;
6565
}
6666
:where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)) {
67-
@apply border-black border-opacity-[0.04] bg-opacity-[0.03] bg-black break-words rounded-md border py-0.5 px-[.25em] text-[.9em] dark:border-white/10 dark:bg-white/10;
67+
@apply hx-border-black hx-border-opacity-[0.04] hx-bg-opacity-[0.03] hx-bg-black hx-break-words hx-rounded-md hx-border hx-py-0.5 hx-px-[.25em] hx-text-[.9em] dark:hx-border-white/10 dark:hx-bg-white/10;
6868
}
6969
:where(pre.mermaid):not(:where(.code-block pre, [class~=not-prose],[class~=not-prose] *)) {
70-
@apply bg-transparent rounded-none dark:bg-transparent;
70+
@apply hx-bg-transparent hx-rounded-none dark:hx-bg-transparent;
7171
}
7272
:where(img):not(:where([class~=not-prose],[class~=not-prose] *)) {
73-
@apply mx-auto my-4 rounded-md;
73+
@apply hx-mx-auto hx-my-4 hx-rounded-md;
7474
}
7575
:where(figure):not(:where([class~=not-prose],[class~=not-prose] *)) {
7676
figcaption {
77-
@apply text-sm text-gray-500 dark:text-gray-400 mt-2 block text-center;
77+
@apply hx-text-sm hx-text-gray-500 dark:hx-text-gray-400 hx-mt-2 hx-block hx-text-center;
7878
}
7979
}
8080
.footnotes {
81-
@apply mt-12 text-sm;
81+
@apply hx-mt-12 hx-text-sm;
8282
}
8383
}
8484

8585
.subheading-anchor {
86-
@apply opacity-0 transition-opacity ltr:ml-1 rtl:mr-1;
86+
@apply hx-opacity-0 hx-transition-opacity ltr:hx-ml-1 rtl:hx-mr-1;
8787

8888
span:target + &,
8989
:hover > &,
9090
&:focus {
91-
@apply opacity-100;
91+
@apply hx-opacity-100;
9292
}
9393

9494
span + &,
9595
:hover > & {
96-
@apply !no-underline;
96+
@apply !hx-no-underline;
9797
}
9898

9999
&:after {
100-
@apply content-['#'] px-1;
101-
@apply text-gray-300 dark:text-neutral-700;
100+
@apply hx-content-['#'] hx-px-1;
101+
@apply hx-text-gray-300 dark:hx-text-neutral-700;
102102
span:target + & {
103-
@apply text-gray-400;
104-
@apply dark:text-neutral-500;
103+
@apply hx-text-gray-400;
104+
@apply dark:hx-text-neutral-500;
105105
}
106106
}
107107
}
108108

109109
article details > summary {
110110
&::-webkit-details-marker {
111-
@apply hidden;
111+
@apply hx-hidden;
112112
}
113113
&::before {
114-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='h-5 w-5' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z' clip-rule='evenodd' /%3E%3C/svg%3E");
114+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='hx-h-5 hx-w-5' viewBox='0 0 20 20' fill='currentColor'%3E%3Cpath fill-rule='evenodd' d='M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z' clip-rule='evenodd' /%3E%3C/svg%3E");
115115
height: 1.2em;
116116
width: 1.2em;
117117
vertical-align: -4px;

0 commit comments

Comments
 (0)