Replies: 3 comments 3 replies
-
I think you can use |
Beta Was this translation helpful? Give feedback.
-
windicss has something called the compilation mode for this use case. This should be possible with the tools we have. That is something @itsMapleLeaf mentioned as well.
I'm not so sure about that one. Currently we provide two ways to inject styles
The gist: import { tw as _tw, apply } from 'twind'
export const tw = (...tokens: Token[]): string => _tw(apply(...tokens)) And now a possible module implementation: import type { Token, Configuration, Instance } from "twind";
import { tw as _tw, apply, create as _create } from "twind";
export * from "twind";
export const create = (options?: Configuration): Instance => {
const { tw, setup } = _create(options);
return {
tw: Object.defineProperties(
(...tokens: Token[]): string => tw(apply(...tokens)),
Object.getOwnPropertyDescriptors(tw)
),
setup,
};
};
export const { tw, setup } = create() Now to point 2: a new observe module using the above import type { ShimConfiguration, TwindObserver } from "twind/observe";
import {
createObserver as _createObserver,
observe as _observe,
} from "twind/observe";
export { tw as defaultTW } from "the-module-above";
export * from "twind/observe";
export const createObserver = ({
tw = defaultTW,
}: ShimConfiguration = {}): TwindObserver => _createObserver({ tw });
export function observe(
this: ShimConfiguration | undefined | void,
target: Node,
config: ShimConfiguration | undefined | void = typeof this == "function"
? undefined
: this
): TwindObserver {
return createObserver(config as ShimConfiguration | undefined).observe(target)
} Same could be done for I hope that helps. |
Beta Was this translation helpful? Give feedback.
-
This is now implemented in twind v1:
Please give it a try. Here are some links to get you started:
Closing this for now. Feel free to re-open. |
Beta Was this translation helpful? Give feedback.
-
Hey 👋,
Twind currently supports hashing of classNames, thereby something like
bg-red-500 font-bold
becomes something liketw-wgsX2 tw-hFiJ4
.I thought, wouldn't it be awesome if multiple classnames could get reduced down to a single hashed one?
Turning
bg-red-500 font-bold text-sm text-white...
into something liketw-efG3p
. That would solve a few issues people have with tailwind, or utility based css in general.What do you think?
Beta Was this translation helpful? Give feedback.
All reactions