Skip to content

Commit

Permalink
Support Tailwind CSS in core dummy app
Browse files Browse the repository at this point in the history
This allows running the core dummy app with the Tailwind required for
setting sails towards the new frontend.
  • Loading branch information
mamhoff committed Jun 19, 2024
1 parent 97f9f69 commit 7003a9c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions core/lib/spree/testing_support/dummy_app/rake_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,41 @@ def initialize(gem_root:, lib_name:)
end
end

if Object.const_defined?(:SolidusAdmin)
namespace :solidus_admin do
namespace :tailwindcss do
desc 'Build Tailwind CSS'
task build: :dummy_environment do
require "solidus_admin"
require "tailwindcss/commands"

Check warning on line 28 in core/lib/spree/testing_support/dummy_app/rake_tasks.rb

View check run for this annotation

Codecov / codecov/patch

core/lib/spree/testing_support/dummy_app/rake_tasks.rb#L22-L28

Added lines #L22 - L28 were not covered by tests

tailwindcss = Tailwindcss::Commands.executable

Check warning on line 30 in core/lib/spree/testing_support/dummy_app/rake_tasks.rb

View check run for this annotation

Codecov / codecov/patch

core/lib/spree/testing_support/dummy_app/rake_tasks.rb#L30

Added line #L30 was not covered by tests

tailwindcss_command = [
tailwindcss,
"--config", SolidusAdmin::Engine.root.join("config/tailwind.config.js"),
"--input", SolidusAdmin::Engine.root.join("app/assets/stylesheets/solidus_admin/application.tailwind.css"),
"--output", DummyApp::Application.root.join("assets/builds/solidus_admin/tailwind.css"),
]

Check warning on line 37 in core/lib/spree/testing_support/dummy_app/rake_tasks.rb

View check run for this annotation

Codecov / codecov/patch

core/lib/spree/testing_support/dummy_app/rake_tasks.rb#L32-L37

Added lines #L32 - L37 were not covered by tests

sh tailwindcss_command.shelljoin
end
end
end

Check warning on line 42 in core/lib/spree/testing_support/dummy_app/rake_tasks.rb

View check run for this annotation

Codecov / codecov/patch

core/lib/spree/testing_support/dummy_app/rake_tasks.rb#L39-L42

Added lines #L39 - L42 were not covered by tests

# Attach Tailwind CSS build to other tasks.
%w[
assets:precompile
test:prepare
spec:prepare
db:test:prepare
].each do |task_name|
next unless Rake::Task.task_defined?(task_name)

Check warning on line 51 in core/lib/spree/testing_support/dummy_app/rake_tasks.rb

View check run for this annotation

Codecov / codecov/patch

core/lib/spree/testing_support/dummy_app/rake_tasks.rb#L45-L51

Added lines #L45 - L51 were not covered by tests

Rake::Task[task_name].enhance(['solidus_admin:tailwindcss:build'])
end
end

Check warning on line 55 in core/lib/spree/testing_support/dummy_app/rake_tasks.rb

View check run for this annotation

Codecov / codecov/patch

core/lib/spree/testing_support/dummy_app/rake_tasks.rb#L53-L55

Added lines #L53 - L55 were not covered by tests

namespace :db do
desc "Drops the test database"
task drop: :dummy_environment do
Expand Down

0 comments on commit 7003a9c

Please sign in to comment.