themesberg / flowbite-vue

Official Vue 3 components built for Flowbite and Tailwind CSS
https://flowbite-vue.com
MIT License
723 stars 116 forks source link

Too many styles #252

Closed new-user-name closed 8 months ago

new-user-name commented 8 months ago

Hi, I did everything by the book, and the resulting css is huge. In the manual I see lines

  content: [
    'node_modules/flowbite-vue/**/*.{js,jsx,ts,tsx}',
    'node_modules/flowbite/**/*.{js,jsx,ts,tsx}'
  ],

Obviously, Tailwind pulls every style found in the files. Is there any way to include only the styles I use in the project?.. For example, I use only fwb-select. How can I import only the related styles?.. I think the problem is that Tailwind does not now during compilation stage which styles will be in use, so we import all 7000 lines of Flowbite.

cogor commented 8 months ago

Hey, from version 0.1.2 you can add components you use into tailwind.config.js It's looks like

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    'node_modules/flowbite-vue/**/FwbModal.vue',
    'node_modules/flowbite-vue/**/FwbAlert.vue',
    'node_modules/flowbite-vue/**/FwbSidebar.vue',
    'node_modules/flowbite-vue/**/FwbSidebarItem.vue',
    "./index.html",
    "./src/**/*.{vue,js,ts,jsx,tsx}",
  ],
  plugins: [
    require('flowbite/plugin')
  ],
}