I have been trying to get the official tailwind plugin for container queries working in a vanilla install of Sage 10 / Bud 6.22.1
I notice that the stock install uses ESM, whereas the Tailwind official plugin documentation shows it using CJS GitHub - tailwindlabs/tailwindcss-container-queries: A plugin for Tailwind CSS v3.2+ that provides utilities for container queries.
Then add the plugin to your tailwind.config.js file:
// tailwind.config.js
module.exports = {
theme: {
// ...
},
plugins: [
require('@tailwindcss/container-queries'),
// ...
],
So I changed the tailwind.config.js
file to the following:
/** @type {import('tailwindcss').Config} config */
import containerQueries from '@tailwindcss/container-queries';
const config = {
content: ['./app/**/*.php', './resources/**/*.{php,vue,js}'],
theme: {
extend: {
colors: {}, // Extend Tailwind's default colors
},
},
plugins: [
containerQueries
],
};
export default config;
Which results in no compile errors and seems fine. Using any @container
classes in my views does not pull in any of the Tailwind Container Query code.
Some of my thoughts:
- Is this a blade issue where it is getting confused with the @ prefix? I tried escaping it using @@ and still no joy
- Should I instead load the plugin from my
bud.config.js
like so:
import containerQueries from "@tailwindcss/container-queries";
...
app.tailwind.setPlugins([containerQueries]);
That did not work either.
Any help appreciated!