vitejs / vite

Next generation frontend tooling. It's fast!
http://vite.dev
MIT License
68.73k stars 6.21k forks source link

Add cursor (.cur) format to build-in assets type list #18679

Closed otomad closed 3 days ago

otomad commented 1 week ago

Description

It is useful when you want to use your own cursor file in the CSS cursor property.

https://developer.mozilla.org/en-US/docs/Web/CSS/cursor

Suggested solution

Add "cur" type in https://github.com/vitejs/vite/blob/58f1df3288b0f9584bb413dd34b8d65671258f6f/packages/vite/client.d.ts#L52-L104 https://github.com/vitejs/vite/blob/58f1df3288b0f9584bb413dd34b8d65671258f6f/packages/vite/src/node/constants.ts#L120-L132

Alternative

No response

Additional context

Usage

import myFancyCursor from "src/assets/cursors/my_fancy_cursor.cur";

const ComponentWithFancyCursor = styled.div`
    cursor: url("${myFancyCursor}"), default;
`;

In fact, I'd like to add the animated cursor (.ani) format as well, which unfortunately doesn't seem to be supported by CSS.

Validations