8000 Add `.tailwind` extension to CSS file · activeadmin/activeadmin@aefff04 · GitHub
[go: up one dir, main page]

Skip to content

Commit aefff04

Browse files
committed
Add .tailwind extension to CSS file
Change the stylesheet filename from `active_admin.css` to `active_admin.tailwind.css` to clearly indicate its role as a Tailwind CSS entry point, not a plain CSS file. The previous name was confusing, as the file contained Tailwind-specific directives like `@config`. This update aligns with conventions in `cssbundling-rails`, where the `.tailwind.css` extension signals Tailwind processing and helps developers immediately recognize the file’s purpose.
1 parent ecfd8a2 commit aefff04

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

UPGRADING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Then add the npm package and update the `build:css` script.
1616

1717
```
1818
yarn add @activeadmin/activeadmin@4.0.0-beta16
19-
npm pkg set scripts.build:css="npx @tailwindcss/cli -i ./app/assets/stylesheets/active_admin.css -o ./app/assets/builds/active_admin.css --minify"
19+
npm pkg set scripts.build:css="npx @tailwindcss/cli -i ./app/assets/stylesheets/active_admin.tailwind.css -o ./app/assets/builds/active_admin.css --minify"
2020
```
2121

2222
If you are already using Tailwind in your app, then update the `build:css` script to chain the above command to your existing one, e.g. `"npx @tailwindcss/cli ... && npx @tailwindcss/cli ..."`, so both stylesheets are generated.
@@ -53,7 +53,7 @@ Starting with version 4.0.0.beta16, ActiveAdmin has migrated from TailwindCSS v3
5353

5454
If you're upgrading from any earlier 4.0.0 beta release, please review and apply the required adjustments outlined below.
5555

56-
Update your `active_admin.css` file:
56+
Rename your `active_admin.css` to `active_admin.tailwind.css` and change:
5757

5858
```diff
5959
-@tailwind base;
@@ -68,7 +68,7 @@ Update the `build:css` script in your `package.json`:
6868

6969
```diff
7070
-"build:css": "tailwindcss -i ./app/assets/stylesheets/active_admin.css -o ./app/assets/builds/active_admin.css --minify -c tailwind-active_admin.config.js"
71-
+"build:css": "npx @tailwindcss/cli -i ./app/assets/stylesheets/active_admin.css -o ./app/assets/builds/active_admin.css --minify"
71+
+"build:css": "npx @tailwindcss/cli -i ./app/assets/stylesheets/active_admin.tailwind.css -o ./app/assets/builds/active_admin.css --minify"
7272
```
7373

7474
You may see the following warning when upgrading:

lib/generators/active_admin/assets/assets_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class AssetsGenerator < Rails::Generators::Base
77
def install_assets
88
remove_file "app/assets/stylesheets/active_admin.scss"
99
remove_file "app/assets/javascripts/active_admin.js"
10-
template "active_admin.css", "app/assets/stylesheets/active_admin.css"
10+
template "active_admin.tailwind.css", "app/assets/stylesheets/active_admin.tailwind.css"
1111
template "tailwind.config.js", "tailwind-active_admin.config.js"
1212
end
1313
end

spec/unit/generators/install_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
require "rails_helper"
33

44
RSpec.describe "ActiveAdmin Installation" do
5-
it "creates active_admin.css" do
6-
expect(File.exist?(Rails.root.join("app/assets/stylesheets/active_admin.css"))).to eq true
5+
it "creates active_admin.tailwind.css" do
6+
expect(File.exist?(Rails.root.join("app/assets/stylesheets/active_admin.tailwind.css"))).to eq true
77
end
88

99
it "creates tailwind config file" do

tasks/test_application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def soft_generate
2121
Kernel.system("rake dependencies:vendor") # ensure flowbite is updated for test app
2222
Dir.chdir(app_dir) do
2323
Kernel.system("yarn add @activeadmin/activeadmin")
24-
Kernel.system('npm pkg set scripts.build:css="npx @tailwindcss/cli -i ./app/assets/stylesheets/active_admin.css -o ./app/assets/builds/active_admin.css --minify"')
24+
Kernel.system('npm pkg set scripts.build:css="npx @tailwindcss/cli -i ./app/assets/stylesheets/active_admin.tailwind.css -o ./app/assets/builds/active_admin.css --minify"')
2525
Kernel.system("yarn install")
2626
Kernel.system("yarn build:css")
2727
end

0 commit comments

Comments
 (0)
0