Error: Cannot apply unknown utility class: bg-lol-dark #16753
Unanswered
charlesdpjohnston
asked this question in
Help
Replies: 2 comments 2 replies
-
You could consider defining the colors in CSS like: @import "tailwindcss"; body { @apply bg-lol-dark; } .gradient-container { @apply bg-gradient-to-b from-lol-dark to-gray-800; }
+
+@theme {
+ --color-lol-dark: #0f1321;
+ --color-lol-accent: #cda869;
+} Otherwise, you can load your @import "tailwindcss"; body { @apply bg-lol-dark; } .gradient-container { @apply bg-gradient-to-b from-lol-dark to-gray-800; }
+
+@config "./relative/path/to/tailwind.config.js"; |
Beta Was this translation helpful? Give feedback.
2 replies
-
My tailwind.config.js:
test.css:
Test in command line:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, whenever I keep having this issue with every utility class I try to use, even default ones. This is my current application.css:
@import "tailwindcss"; body { @apply bg-lol-dark; } .gradient-container { @apply bg-gradient-to-b from-lol-dark to-gray-800; }
and this is the full error:
$ ruby bin/rails tailwindcss:build
Error: Cannot apply unknown utility class: bg-lol-dark
bin/rails aborted!
Command failed with exit 1: C:/Users/charl/.gem/ruby/3.3.0/gems/tailwindcss-ruby-4.0.8-x64-mingw-ucrt/exe/x64-mingw-ucrt/tailwindcss
This is with a clean stall of tailwind using the instructions on the official docs for ruby on rails: https://tailwindcss.com/docs/installation/framework-guides/ruby-on-rails
this is my tailwind.confg.js:
module.exports = { content: [ './app/views/**/*.{erb,haml,html,slim}', './app/helpers/**/*.rb', './app/assets/tailwind/**/*.css', // Matches application.css './app/javascript/**/*.js' ], theme: { extend: { animation: { 'pulse-slow': 'pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite' }, colors: { 'lol-dark': '#0f1321', 'lol-accent': '#cda869' } } }, plugins: [require('@tailwindcss/forms')] }
Does anyone know how to fix this?
I also got the same error when using this as my application.css:
@import 'tailwindcss/theme' theme(reference);
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
.test-bg {
@apply bg-blue-500;
}
I don't know why this wouldn't work since bg-blue-500 should be a default utility.
Beta Was this translation helpful? Give feedback.
All reactions