tremorlabs / tremor

React components to build charts and dashboards
https://npm.tremor.so
Apache License 2.0
16.22k stars 467 forks source link

[Feature]: Treeshake styles / reduce bundle size #493

Open pingustar opened 1 year ago

pingustar commented 1 year ago

What problem does this feature solve?

Reduce bundle size by only adding the styles that are being used. If this is already possible, then please add instructions for it to your documentation.

What does the proposed API look like?

Instead of adding the whole tremor node_modules folder to be purged by tailwind, I would expect to either:

  1. Option:

add on a per component basis to the content list in tailwind config: (add this code snippet to the documentation for each component for easy access)

"./node_modules/@tremor/react/dist/components/input-elements/Button/**/*.{js,ts,jsx,tsx}", // Button component

or

  1. Option

add a safe list to your documentation for each component. Then we can just copy paste this list and add it to our tailwind config

mitrotasios commented 1 year ago

good point, we're working on reducing the style overhead in v3, especially for colours. I think option one is a good approach and can be added to the documentation, thanks for the suggestion!