Can't use theme()
function together with postcss-each
plugin
#7362
-
What version of Tailwind CSS are you using? For example: v3.0.18 What build tool (or framework if it abstracts the build tool) are you using? For example: PostCSS ^8.4.5 Webpack 5.28.0 What version of Node.js are you using? For example: v16.13.0 What browser are you using? For example: Chrome, What operating system are you using? For example: macOS Describe your issue CSS code @each $val, $i in slate,blue,purple,amber,emerald {
#template-timeline-theme-$(i) {
background: theme(colors.$(val).500);
}
} Error message: Module build failed (from ./node_modules/@vue/cli-service/node_modules/postcss-loader/dist/cjs.js):
SyntaxError
(26:5) 'colors.$(val).500' does not exist in your theme config. 'colors' has the following keys: 'inherit', 'current', 'transparent', 'black', 'white', 'slate', 'gray', 'zinc', 'neutral', 'stone', 'red', 'orange', 'amber', 'yellow', 'lime', 'green', 'emerald', 'teal', 'cyan', 'sky', 'blue', 'indigo', 'violet', 'purple', 'fuchsia', 'pink', 'rose' |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey! Make sure Tailwind is running after postcss-each, otherwise Tailwind is receiving Controlling plugin order is harder in PostCSS 8 but https://github.com/madyankin/postcss-each/#aftereach
|
Beta Was this translation helpful? Give feedback.
Hey! Make sure Tailwind is running after postcss-each, otherwise Tailwind is receiving
$(var)
instead ofslate
for example.Controlling plugin order is harder in PostCSS 8 but
postcss-each
has an API specifically for this:https://github.com/madyankin/postcss-each/#aftereach