forked from Shiloh/githaven
Move custom tw-
helpers to tailwind plugin (#31184)
Move the previous custom `tw-` classes to be defined in a tailwind plugin. I think it's cleaner that way and I also verified double-class works as expected: <img width="299" alt="Screenshot 2024-05-30 at 19 06 24" src="https://github.com/go-gitea/gitea/assets/115237/003cbc76-2013-46a0-9e27-63023fa7c7a4">
This commit is contained in:
parent
0f0db6a14f
commit
8c68c5e436
@ -1,6 +1,7 @@
|
|||||||
import {readFileSync} from 'node:fs';
|
import {readFileSync} from 'node:fs';
|
||||||
import {env} from 'node:process';
|
import {env} from 'node:process';
|
||||||
import {parse} from 'postcss';
|
import {parse} from 'postcss';
|
||||||
|
import plugin from 'tailwindcss/plugin.js';
|
||||||
|
|
||||||
const isProduction = env.NODE_ENV !== 'development';
|
const isProduction = env.NODE_ENV !== 'development';
|
||||||
|
|
||||||
@ -98,4 +99,26 @@ export default {
|
|||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
plugins: [
|
||||||
|
plugin(({addUtilities}) => {
|
||||||
|
addUtilities({
|
||||||
|
// tw-hidden must win all other "display: xxx !important" classes to get the chance to "hide" an element.
|
||||||
|
// do not use:
|
||||||
|
// * "[hidden]" attribute: it's too weak, can not be applied to an element with "display: flex"
|
||||||
|
// * ".hidden" class: it has been polluted by Fomantic UI in many cases
|
||||||
|
// * inline style="display: none": it's difficult to tweak
|
||||||
|
// * jQuery's show/hide/toggle: it can not show/hide elements with "display: xxx !important"
|
||||||
|
// only use:
|
||||||
|
// * this ".tw-hidden" class
|
||||||
|
// * showElem/hideElem/toggleElem functions in "utils/dom.js"
|
||||||
|
'.hidden.hidden': {
|
||||||
|
'display': 'none',
|
||||||
|
},
|
||||||
|
// proposed class from https://github.com/tailwindlabs/tailwindcss/pull/12128
|
||||||
|
'.break-anywhere': {
|
||||||
|
'overflow-wrap': 'anywhere',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
@ -35,22 +35,6 @@ Gitea's private styles use `g-` prefix.
|
|||||||
.interact-bg:hover { background: var(--color-hover) !important; }
|
.interact-bg:hover { background: var(--color-hover) !important; }
|
||||||
.interact-bg:active { background: var(--color-active) !important; }
|
.interact-bg:active { background: var(--color-active) !important; }
|
||||||
|
|
||||||
/*
|
|
||||||
tw-hidden must win all other "display: xxx !important" classes to get the chance to "hide" an element.
|
|
||||||
do not use:
|
|
||||||
* "[hidden]" attribute: it's too weak, can not be applied to an element with "display: flex"
|
|
||||||
* ".hidden" class: it has been polluted by Fomantic UI in many cases
|
|
||||||
* inline style="display: none": it's difficult to tweak
|
|
||||||
* jQuery's show/hide/toggle: it can not show/hide elements with "display: xxx !important"
|
|
||||||
only use:
|
|
||||||
* this ".tw-hidden" class
|
|
||||||
* showElem/hideElem/toggleElem functions in "utils/dom.js"
|
|
||||||
*/
|
|
||||||
.tw-hidden.tw-hidden { display: none !important; }
|
|
||||||
|
|
||||||
/* proposed class from https://github.com/tailwindlabs/tailwindcss/pull/12128 */
|
|
||||||
.tw-break-anywhere { overflow-wrap: anywhere !important; }
|
|
||||||
|
|
||||||
@media (max-width: 767.98px) {
|
@media (max-width: 767.98px) {
|
||||||
/* double selector so it wins over .tw-flex (old .gt-df) etc */
|
/* double selector so it wins over .tw-flex (old .gt-df) etc */
|
||||||
.not-mobile.not-mobile {
|
.not-mobile.not-mobile {
|
||||||
|
Loading…
Reference in New Issue
Block a user