10BC0 Improve setup instructions by tagliala · Pull Request #8545 · activeadmin/activeadmin · GitHub
[go: up one dir, main page]

Skip to content

Conversation

tagliala
Copy link
Contributor
  • Separates database setup from server startup and clarifies asset handling.
  • Copy cssbundling-rails instructions from Upgrading guide as a recommended approach for managing Tailwind CSS assets
  • Suggest to start the server with bin/dev to handle both web and CSS building processes.

Ref: #8538

[ci skip]

@tagliala tagliala force-pushed the chore/fix-installation-guide branch 4 times, most recently from 024db0e to 8b381a9 Compare November 17, 2024 10:22
- Separate database setup from server startup and clarifies asset
  handling process
- Copy `cssbundling-rails` instructions from the Upgrading guide as a
  recommended approach for managing Tailwind CSS assets
- Suggest starting the server with `bin/dev` to handle both web and CSS
  building process

Ref: #8538

[ci skip]
@tagliala tagliala force-pushed the chore/fix-installation-guide branch from 8b381a9 to ae6eeba Compare November 17, 2024 10:22
rails importmap:install

bundle add cssbundling-rails
rails css:install:tailwind
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessary to install tailwind. One can run command rails css:install and it should work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, gem 'tailwindcss-rails' may not be installed


```sh
bundle add importmap-rails
rails importmap:install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know from my upgrade experience - it's also not necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rails importmap:install is not necessary because it is being performed by rails g active_admin:install


```sh
bin/dev
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for those who doesn't have Procfile.dev you should give another option:

yarn build:css 
rails s

@andrewroth
Copy link
10BC0

Hi,

I'm starting a new rails 8 app with active admin, and the styles didn't load at all, after following the basic guide.

After some searching I came across this, and followed the commands, but I get 02:15:57 css.1 | Specified input file ./app/assets/stylesheets/active_admin.css does not exist. -- any ideas?

Should I just go back to rails 7 for now and accept rails 8 and active admin are incompatible (is this actually the case)? Thanks.

@tagliala
Copy link
Contributor Author
tagliala commented Nov 26, 2024

Should I just go back to rails 7 for now and accept rails 8 and active admin are incompatible (is this actually the case)?

They are compatible:

#8538 (reply in thread)

If you have some sort of edge cases, or different instructions, please provide more information so we can improve the installation guide


edit: guide updated and tested again, I confirm that Rails 8.0 and Active Admin 4 beta are compatible

image

@andrewroth
Copy link

I still have no css after hours of effort.

If I run npx tailwindcss -i ./app/assets/stylesheets/active_admin.css -o ./app/assets/builds/active_admin.css --minify -c tailwind-active_admin.config.js manually, I get:

Rebuilding...
Error: Cannot find module 'tailwindcss/plugin'
Require stack:
...
 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/andrew/Development/node_modules/@activeadmin/activeadmin/plugin.js'
  ]
}

I've googled "Error: Cannot find module 'tailwindcss/plugin'" and tried every possible fix I can find with no success.

@andrewroth
Copy link

Is it possible to use active admin without tailwind?

@tagliala
Copy link
Contributor Author
tagliala commented Nov 26, 2024

Can you please provide the list of commands that you are executing?

Also please include Ruby and Node versions

ruby --version
# ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [x86_64-darwin24]

node --version
# v20.18.1

rails _8.0.0_ new my_app
cd my_app
bundle add activeadmin -v=4.0.0beta14
bundle add devise
rails g active_admin:install
bundle add cssbundling-rails
rails css:install:tailwind
rails db:migrate
rails db:seed
yarn add @activeadmin/activeadmin@4.0.0-beta14
npm pkg set scripts.build:css="tailwindcss -i ./app/assets/stylesheets/active_admin.css -o ./app/assets/builds/active_admin.css --minify -c tailwind-active_admin.config.js"

Is it possible to use active admin without tailwind?

Can't tell, maybe there are infos here: #8223

@andrewroth
Copy link

I am on an old node and osx, maybe that has something to do with it?

node --version
v16.16.0

ruby --version
ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [x86_64-darwin17]

@tagliala
Copy link
Contributor Author

node --version
v16.16.0

This may be an issue, but we are not aware of such issue.

I remember that I couldn't update to v4 with Node 16, but I need to check why

@tagliala
Copy link
Contributor Author

I'm successfully running the application with node 16.20.2

@andrewroth
Copy link

That did get further, staring from a new app from scratch.

Now I get this:

image

@tagliala
Copy link
Contributor Author

looks like assets are not being build

Can you try ./bin/dev instead of rails s and report any error in the asset building?

@renatoaug
Copy link

That did get further, staring from a new app from scratch.

Now I get this:

image

I am with this same problem here.

I ran using ./bin/dev and the result was:

image

@tagliala
Copy link
Contributor Author
tagliala commented Jan 9, 2025

Hi,

These are the instructions to create an app from scratch

SuperAdmin::CompaniesController looks like existing code

@renatoaug
Copy link

Hi,

These are the instructions to create an app from scratch

SuperAdmin::CompaniesController looks like existing code

Hi @tagliala ,

I was talking about the broken layout:

image

I followed all the steps here https://github.com/activeadmin/activeadmin/blob/master/UPGRADING.md to upgrade from v3 to v4 but I think the css is not being applied.

@teaforthecat
Copy link

Hi, just want to point out that this is a reasonable alternative to cssbundler if the goals are these:

  • ActiveAdmin 3
  • Rails 8 (with or without tailwind)
  • Not requiring node
bundle add dartsass-rails
echo "Rails.application.config.dartsass.builds = {\n  'active_admin.scss' => 'active_admin.css'\n}" > config/initializers/dartsass.rb
echo "sass: bin/rails dartsass:watch" >> Procfile.dev
bin/dev

I wonder if this could go into the activeadmin:install task just for the time between Rails 8 being out and ActiveAdmin 4 not yet out?

@tagliala tagliala mentioned this pull request Jan 29, 2025
1 task
@brendon
Copy link
Contributor
brendon commented Jul 24, 2025

Hi,
These are the instructions to create an app from scratch
SuperAdmin::CompaniesController looks like existing code

Hi @tagliala ,

I was talking about the broken layout:

image

I followed all the steps here https://github.com/activeadmin/activeadmin/blob/master/UPGRADING.md to upgrade from v3 to v4 but I think the css is not being applied.

I'm having a similar problem with the upgrade to 4. I notice that the generated css file only has a handful of tailwind classes. Perhaps it's not seeing all the classnames in the code that it needs to prevent them from being stripped out of the build?

Did you manage to fix it?

@tagliala
Copy link
Contributor Author
tagliala commented Jul 24, 2025

Perhaps it's not seeing all the classnames in the code that it needs to prevent them from being stripped out of the build?

Hello, maybe I did not get this question.

It's normal for Tailwind to remove unused CSS classes during the build process. Could you clarify your question or specify what you're expecting by using the discussion at #8538, since this pull request isn't related to the topic?


Maybe it is related to the fact that now the latest stable Tailwind version is v4? Please ensure that v3 is being used

@brendon
Copy link
Contributor
brendon commented Jul 24, 2025

Perhaps it's not seeing all the classnames in the code that it needs to prevent them from being stripped out of the build?

Hello, maybe I did not get this question.

It's normal for Tailwind to remove unused CSS classes during the build process. Could you clarify your question or specify what you're expecting by using the discussion at #8538, since this pull request isn't related to the topic?

Maybe it is related to the fact that now the latest stable Tailwind version is v4? Please ensure that v3 is being used

That was exactly the issue. I had to pin to v3:

gem "tailwindcss-ruby", "~> 3.4.17"

I assume that because of the many ways tailwind can be present, it doesn't make sense to have this as a hard dependency of the active_admin gem? It might be something to add to the UPGRADE.md guide though as that's what I was following :)

@tagliala
Copy link
Contributor Author

I assume that because of the many ways tailwind can be present, it doesn't make sense to have this as a hard dependency of the active_admin gem? It might be something to add to the UPGRADE.md guide though as that's what I was following :)

Correct. We can suggest a way, but the suggested way may not work with host application or developer preferences

Additionally, we are in the middle of a migration to v4 and there is a new interesting (experimental) feature in tailwindcss-rails for engines, so this can change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0