tailwindcss: .container plugin not working out of the box
The “container” plugin that ships with Tailwind doesn’t seem to be working for me.
my tailwind.js file:
plugins: [
require('tailwindcss/plugins/container')({
center: true,
padding: '1rem',
}),
]
my mix file:
mix.js('resources/assets/js/app.js', 'public/js')
.postCss('resources/assets/css/app.css', 'public/css')
.tailwind()
I can verify that my tailwind.js file is being used (by switching color values and seeing them reflected)
I’m on 0.5.2
A co-worker set up a brand new tailwind project and verified the same issue.
This could very well be PEBCAK, but I’m kinda out of ideas.
If you don’t quickly identify this as an actual bug I will dig deeper, just want to make sure this isn’t currently an issue effecting everyone.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 18 (4 by maintainers)
Commits related to this issue
- Adding is `@tailwind components;` Without `@tailwind components;` plugins (like container which is added by default) will not work. See: https://github.com/tailwindcss/tailwindcss/issues/446#issueco... — committed to diit/next.js by diit 6 years ago
- Adding is `@tailwind components;` (#5897) Without `@tailwind components;` plugins (like container which is added by default) will not work. See: https://github.com/tailwindcss/tailwindcss/issues/446... — committed to vercel/next.js by diit 6 years ago
Do you have
@tailwind components
in your CSS file? On Wed, Apr 4, 2018 at 5:28 PM nordentwickler notifications@github.com wrote:Hi @adamwathan, Indeed it seems related to
tailwind.macro
. I’m having the same issue usingstyled-components
andtailwind
. The workaround I found for now was to add thecontainer
class directly to my styled component.@SimonJ Make sure that
@tailwind components;
is behind@tailwind utilities;
in your css file.Same problem here. Gatsby, Emotion, Babel, PostCss. For files, see below. I don’t know if it is emotion at fault… when I avoid using emotion and just throw a container class into a JSX div:
…when I mouse over the
pt-24
style in VSS, the style resolves, butcontainer
does not.Some details:
style.css
tailwind.config.js
babel-plugin-macros-config.js
postcss.config.js
This tripped me up as well. One place where it could be mentioned is in the container section in the docs: https://tailwindcss.com/docs/container – I remember seeing the
@tailwind components
directive while installing but not thinking I was using any plugins (i.e. this was a clean Tailwind installation), I ignored and forgot it.It would be nice to add this to the docs 😃
Maybe it’s worth to add on the docs which part related to what tailwind package (utilities/base/components)