Tailwind Style Issues

67 Views Asked by At

I'm facing an issue with my Tailwind CSS installation using npm. When I install Tailwind CSS using npm, I can only find up to 1758 lines of CSS in my generated file, and the rest of the code seems to be missing. The strange part is that when I use the script CDN directly, everything works fine. I've tried updating npm, but the problem persists.

1

There are 1 best solutions below

0
On

As stated above, Tailwind will build the CSS on npm run build, or if you are using vite, on refresh if enabled. This means that it is only going to include the styles used, and general styles in the files you have included in the directive for where to find the files with CSS in them. My tailwind.config.js

export default {
    content: [
        './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
        './storage/framework/views/*.php',
        './resources/views/**/*.blade.php',
        './public/js/preline/dist/*.js',
        './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
    ],
]

My config will find all files within the views directory, and will parse them for the needed style tags.

When running with the CDN, it will supply all of the styles as it is not generated on an as needed basis, which can be slower in larger applications.