Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Admin Tailwind build when generating sandbox #5636

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,17 @@ data already loaded.
bin/sandbox
```

* Start the server (`bin/rails` will forward any argument to the sandbox)
* You can start the Rails server and other services from either the Solidus folder or the
sandbox one by running the command:

```bash
bin/rails server
bin/dev
```

Please note: if you run `bin/rails server` or similar commands, only the Rails server will
start. This might cause the error `couldn't find file 'solidus_admin/tailwind.css'` when you
try to load admin pages.

### Tests

Solidus uses [RSpec](http://rspec.info) for tests. Refer to its documentation for
Expand Down
15 changes: 8 additions & 7 deletions core/lib/generators/solidus/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class InstallGenerator < Rails::Generators::AppBase
class_option :sample, type: :boolean, default: true, banner: 'Load sample data (migrations and seeds must be run)'
class_option :active_storage, type: :boolean, default: true, banner: 'Install ActiveStorage as image attachments handler for products and taxons'
class_option :admin_preview, type: :boolean, default: true, desc: 'Install the admin preview'
class_option :build_admin_tailwind, type: :boolean, default: true, desc: 'Build and install Solidus Admin Tailwind CSS file and rake tasks'
class_option :auto_accept, type: :boolean
class_option :user_class, type: :string
class_option :admin_email, type: :string
Expand Down Expand Up @@ -175,20 +176,20 @@ def run_migrations
end
end

def install_subcomponents
apply_template_for :authentication, @selected_authentication
apply_template_for :frontend, @selected_frontend
apply_template_for :payment_method, @selected_payment_method
end

def install_solidus_admin
return unless options[:admin_preview]

say_status :installing, "SolidusAdmin", :blue
unless File.read(app_path.join('Gemfile')).include?('solidus_admin')
bundle_command 'add solidus_admin -v ">= 0.2"'
end
generate 'solidus_admin:install'
end

def install_subcomponents
apply_template_for :authentication, @selected_authentication
apply_template_for :frontend, @selected_frontend
apply_template_for :payment_method, @selected_payment_method
generate "solidus_admin:install #{'--tailwind' if options[:build_admin_tailwind]}"
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the back and forth (and it might not be related to this PR), but at this point I don't understand in which case we don't need to install Tailwind along with the new admin. I mean, in which circumstances build_admin_tailwind will be set to false?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right now, never. But if for any reason somebody wants to disable it, we give the possibility to do it with rails g solidus:install --no-build-admin-tailwind, for example.

end

def populate_seed_data
Expand Down
Loading