-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Description
The `config/tailwind.config.js` generated during `rails generate solidus:install` overrides the `blue` color with a single hex value (`#2554B1`), which removes Tailwind's default blue color scale (`blue-50` through `blue-950`).
This breaks compatibility with:
- Tailwind CSS official documentation examples
- Tailwind UI and component libraries
- Community tutorials and blog posts
- Code portability from other projects
- Developer expectations when using standard Tailwind colors
Steps to Reproduce
- Install Solidus with `rails generate solidus:install --auto-accept`
- Try to use standard Tailwind classes like `bg-blue-600` or `hover:bg-blue-500`
- The styles are not applied because these color variants don't exist
Example - Rails scaffold:
```bash
rails g scaffold Post content:text
```
Visit `/posts` - the "New post" button styling is broken.
Example - Copying from Tailwind docs:
Any component from https://tailwindcss.com/docs using `blue-*` classes won't work.
Expected Behavior
Developers should be able to use Tailwind's default color scale, or the custom color should have a unique name to avoid conflicts.
Actual Behavior
Classes like `bg-blue-600`, `text-blue-500`, etc. don't exist in the compiled CSS because the entire blue scale is replaced by a single color.
Current config (problematic):
```javascript
// config/tailwind.config.js line 72
extend: {
colors: {
blue: '#2554B1', // ← This replaces the entire blue scale
...
}
}
```
Impact
Breaking changes for:
- ❌ Tailwind documentation examples
- ❌ Tailwind UI components
- ❌ Community code snippets
- ❌ Rails scaffold (and other generators)
- ❌ Developer experience (unexpected behavior)
Suggested Fixes
Option 1: Rename to avoid conflict (Recommended)
```javascript
extend: {
colors: {
'solidus-blue': '#2554B1',
// Tailwind's default blue scale remains available
}
}
```
Option 2: Define full color scale
```javascript
extend: {
colors: {
blue: {
DEFAULT: '#2554B1',
50: '#eff6ff',
100: '#dbeafe',
// ... define all variants
900: '#1e3a8a',
}
}
}
```
Option 3: Use Tailwind's color system properly
```javascript
const defaultTheme = require('tailwindcss/defaultTheme')
module.exports = {
theme: {
extend: {
colors: {
'brand': '#2554B1',
// Keep default blue scale
blue: defaultTheme.colors.blue,
}
}
}
}
```
Environment
- Solidus: 4.6.2
- Rails: 8.0.4
- Tailwind CSS: 3.4.x
Related
This affects any project using Tailwind CSS, not just Rails applications.