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

Ci fixes #187

Merged
merged 5 commits into from
Jan 30, 2025
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
10 changes: 4 additions & 6 deletions lib/generators/inertia/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,9 @@ def install_example_page

def install_tailwind
say 'Installing Tailwind CSS'
add_dependencies(%w[tailwindcss postcss autoprefixer @tailwindcss/forms @tailwindcss/typography
@tailwindcss/container-queries])

template 'tailwind/tailwind.config.js', file_path('tailwind.config.js')
copy_file 'tailwind/postcss.config.js', file_path('postcss.config.js')
add_dependencies(%w[tailwindcss @tailwindcss/vite @tailwindcss/forms @tailwindcss/typography])
prepend_file vite_config_path, "import tailwindcss from '@tailwindcss/vite'\n"
insert_into_file vite_config_path, "\n tailwindcss(),", after: 'plugins: ['
copy_file 'tailwind/application.css', js_file_path('entrypoints/application.css')

if application_layout.exist?
Expand Down Expand Up @@ -265,7 +263,7 @@ def vite_tag

def inertia_resolved_version
@inertia_resolved_version ||= Gem::Version.new(
`npm show @inertiajs/core@#{options[:inertia_version]} version`.strip
`npm show @inertiajs/core@#{options[:inertia_version]} version --json | tail -n2 | head -n1 | tr -d '", '`.strip
)
end

Expand Down
15 changes: 3 additions & 12 deletions lib/generators/inertia/install/templates/tailwind/application.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@import "tailwindcss";

/*

@layer components {
.btn-primary {
@apply py-2 px-4 bg-blue-200;
}
}

*/
@plugin "@tailwindcss/typography";
@plugin "@tailwindcss/forms";

This file was deleted.

This file was deleted.

17 changes: 11 additions & 6 deletions spec/generators/install/install_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
directory('app/frontend') do
no_file('entrypoints/application.css')
end
no_file('postcss.config.js')
no_file('tailwind.config.js')
end)
end
end
Expand All @@ -67,7 +65,7 @@

before { prepare_application }

it 'installs Tailwind' do
it 'installs Tailwind with vite plugin' do
expect { generator }.not_to raise_error
expect_tailwind_config
end
Expand Down Expand Up @@ -134,10 +132,17 @@ def prepare_application(with_vite: true)
def expect_tailwind_config
expect(destination_root).to(have_structure do
directory('app/frontend') do
file('entrypoints/application.css')
file('entrypoints/application.css') do
contains('@import "tailwindcss";')
end
end
file('package.json') do
contains('"tailwindcss":')
contains('"@tailwindcss/vite":')
end
file('vite.config.ts') do
contains('tailwindcss(),')
end
file('postcss.config.js')
file('tailwind.config.js')
end)
end

Expand Down
3 changes: 3 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
require 'spec_helper'
# Requiring logger fixes an issue between concurrent-ruby and activesupport in Rails < 7.1
# https://github.com/rails/rails/issues/54260
require 'logger'
ENV['RAILS_ENV'] ||= 'test'

require File.expand_path('../dummy/config/environment', __FILE__)
Expand Down