I have a Laravel project with Tailwind and have Webpack configured:
mix.js('resources/js/app.js', 'public/js')
.postCss('resources/css/app.css', 'public/css', [
require("tailwindcss"),
]);
And this is my Tailwind.config:
const defaultTheme = require("tailwindcss/defaultTheme");
const colors = require("tailwindcss/colors");
module.exports = {
content: [
"./resources/**/*.blade.php",
"./resources/**/*.js",
"./resources/**/*.vue",
],
theme: {
extend: {
fontFamily: {
sans: ["Rubik", ...defaultTheme.fontFamily.sans],
},
},
colors: {
transparent: "transparent",
current: "currentColor",
black: colors.black,
white: colors.white,
gray: colors.gray,
emerald: colors.emerald,
brandcolor: {
50: "#f3d2e4",
100: "#ff53aa",
200: "#ff49a0",
300: "#ff3f96",
400: "#f8358c",
500: "#ee2b82",
600: "#e42178",
700: "#da176e",
800: "#d00d64",
900: "#c6035a",
},
blue: {
50: "#a6ecfd",
100: "#50d4ff",
200: "#46caff",
300: "#3cc0f6",
400: "#32b6ec",
500: "#28ace2",
600: "#1ea2d8",
700: "#1498ce",
800: "#0a8ec4",
900: "#0084ba",
},
teal: colors.teal,
yellow: colors.yellow,
},
},
plugins: [
require("@tailwindcss/forms"),
require("@tailwindcss/aspect-ratio"),
require("@tailwindcss/typography"),
],
};
As you can see I changed and add some colors.
When I have this in my code and I compile it:
<div class="bg-brandcolor-600">
It works, but when I change it to 800
, I have to recompile it.
What do I have to change so the FULL css is compiled with all options available? So i can also do things like:
<div class="bg-{{ $color ?? 'brandcolor' }}-600">
And make the color as a variable in my code. And I know, that this is not recommended, but the CSS doesn't have to be small for this project.