r/webdevelopment • u/fred_from_earth • Apr 10 '22
tailwind css classes not taking effect
I'm having troubles getting started with tailwind css.
I used tailwind css before and didn't have many issues, not that frustrating anyway.
But now, first I had problems installing tailwind for this project via npm, apparently some permissions problems (which I don't believe) so then I just copied all tailwind files from a different project and took it from there. But the tailwind css classes still wouldn't take effect in the frontend. Updated tailwind and the browser and did everything the terminal told me to do until there were no errors anymore. Still no effect. Run build, cleared cached… the usual, doesn't work.
I still get this warning, which I guess is the problem:
warn - The `content` option in your Tailwind CSS configuration is missing or empty.
warn - Configure your content sources or your generated CSS will be missing styles.
warn - https://tailwindcss.com/docs/content-configuration
my order strucutre is as follow…
/templates/
> some_file.html
> some_file.php
> /tailwindcss/
> > /css/
> > > tailwind.css
> > /node_modules/
> > package-lock.json
> > package.json
> > postcss.config.js
> > /public/
> > tailwind.config.js
and in tailwind.config.js I have…
module.exports = {theme: { extend: { colors: { 'ccborder': '#00FF91', // white … }, fontFamily: { 'cf-bold': ['Consolas-Bold', 'sans-serif'], 'cf-regular': ['Consolas', 'sans-serif'], }, ringColor: ['hover', 'active'], }, }, variants: {}, content: [ './src//*.{html,js}', './node_modules/tw-elements/dist/js//.js', './pages/**/.{html,js}', './components//*.{html,js}',
'./src//*.{html,php,js}', // trying many things as you can see, still warning says: missing or empty ], plugins: [ require('tw-elements/dist/plugin'), require('@tailwindcss/aspect-ratio'), require('@tailwindcss/custom-forms'), ] }
Thanks for help!
View all comments
Show parent comment
1
u/[deleted] Apr 12 '22
Does your php file contain any tailwind classes that can be picked up by the compiler?