railsui 3.2.7 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -1
  3. data/README.md +196 -42
  4. data/app/assets/javascripts/railsui-controllers.js +12 -0
  5. data/app/controllers/railsui/configurations_controller.rb +11 -2
  6. data/app/helpers/railsui/application_helper.rb +12 -0
  7. data/app/javascript/controllers/index.js +3 -31
  8. data/app/javascript/controllers/railsui_anchor_controller.js +4 -3
  9. data/app/javascript/controllers/railsui_auto_expand_text_area_controller.js +1 -1
  10. data/app/javascript/controllers/railsui_canvas_controller.js +1 -1
  11. data/app/javascript/controllers/railsui_code_controller.js +3 -28
  12. data/app/javascript/controllers/railsui_color_controller.js +1 -1
  13. data/app/javascript/controllers/railsui_configuration_controller.js +1 -1
  14. data/app/javascript/controllers/railsui_dialog_controller.js +1 -1
  15. data/app/javascript/controllers/railsui_flash_controller.js +1 -1
  16. data/app/javascript/controllers/railsui_helper_controller.js +1 -1
  17. data/app/javascript/controllers/railsui_loading_controller.js +1 -1
  18. data/app/javascript/controllers/railsui_modal_controller.js +4 -3
  19. data/app/javascript/controllers/railsui_nav_controller.js +4 -3
  20. data/app/javascript/controllers/railsui_pages_controller.js +1 -1
  21. data/app/javascript/controllers/railsui_prevent_controller.js +1 -1
  22. data/app/javascript/controllers/railsui_scroll_controller.js +1 -1
  23. data/app/javascript/controllers/railsui_scroll_spy_controller.js +1 -1
  24. data/app/javascript/controllers/railsui_search_controller.js +1 -1
  25. data/app/javascript/controllers/railsui_smooth_controller.js +1 -1
  26. data/app/javascript/controllers/railsui_snippet_controller.js +1 -1
  27. data/app/views/layouts/railsui/application.html.erb +7 -5
  28. data/app/views/layouts/railsui/fullwidth.html.erb +4 -4
  29. data/app/views/layouts/railsui/landing.html.erb +3 -4
  30. data/app/views/layouts/railsui/routes.html.erb +4 -3
  31. data/app/views/railsui/admin/_form.html.erb +18 -1
  32. data/app/views/railsui/admin/fields/_theme.html.erb +0 -1
  33. data/app/views/railsui/shared/_cdn_dependencies.html.erb +121 -0
  34. data/app/views/railsui/shared/_inline_controllers.html.erb +498 -0
  35. data/app/views/railsui/shared/_snippet.html.erb +23 -1
  36. data/app/views/railsui/themes/hound/forms/_input_group.html.erb +3 -1
  37. data/app/views/railsui/themes/shepherd/authentication/devise/_overview.html.erb +30 -28
  38. data/app/views/railsui/themes/shepherd/authentication/static/_overview.html.erb +8 -8
  39. data/app/views/railsui/themes/shepherd/content/typography/_headings.html.erb +23 -21
  40. data/app/views/railsui/themes/shepherd/forms/_input.html.erb +1 -1
  41. data/guides/CONFIGURATION.md +199 -0
  42. data/guides/MIGRATION_GUIDE.md +220 -0
  43. data/lib/generators/railsui/install/install_generator.rb +124 -38
  44. data/lib/generators/railsui/install/templates/Procfile.dev.build +1 -0
  45. data/lib/generators/railsui/install/templates/Procfile.dev.nobuild +2 -0
  46. data/lib/generators/railsui/install/templates/bin/dev +21 -0
  47. data/lib/generators/railsui/install/templates/themes/corgie/stylesheets/railsui/actiontext.css +0 -1
  48. data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui.html.erb +7 -2
  49. data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui_admin.html.erb +7 -2
  50. data/lib/generators/railsui/install/templates/themes/corgie/views/layouts/rui/railsui_auth.html.erb +6 -2
  51. data/lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/{privacy.html.erb → privacy_policy.html.erb} +1 -1
  52. data/lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/terms.html.erb +2 -2
  53. data/lib/generators/railsui/install/templates/themes/corgie/views/rui/shared/sidebar/_link.html.erb +4 -4
  54. data/lib/generators/railsui/install/templates/themes/hound/stylesheets/railsui/actiontext.css +0 -1
  55. data/lib/generators/railsui/install/templates/themes/hound/views/layouts/rui/railsui.html.erb +6 -2
  56. data/lib/generators/railsui/install/templates/themes/hound/views/layouts/rui/railsui_admin.html.erb +6 -2
  57. data/lib/generators/railsui/install/templates/themes/shepherd/stylesheets/railsui/actiontext.css +0 -1
  58. data/lib/generators/railsui/install/templates/themes/shepherd/views/layouts/rui/railsui.html.erb +6 -2
  59. data/lib/generators/railsui/install/templates/themes/shepherd/views/layouts/rui/railsui_admin.html.erb +6 -2
  60. data/lib/generators/railsui/update/update_generator.rb +40 -4
  61. data/lib/railsui/configuration.rb +116 -15
  62. data/lib/railsui/engine.rb +15 -0
  63. data/lib/railsui/theme_setup.rb +598 -38
  64. data/lib/railsui/version.rb +1 -1
  65. data/lib/railsui.rb +10 -7
  66. data/lib/tasks/install.rake +9 -3
  67. data/lib/tasks/migrate.rake +219 -0
  68. metadata +26 -4
  69. data/.claude/settings.local.json +0 -10
@@ -1,3 +1,3 @@
1
1
  module Railsui
2
- VERSION = "3.2.7"
2
+ VERSION = "3.3.0"
3
3
  end
data/lib/railsui.rb CHANGED
@@ -4,6 +4,7 @@ require "railsui/version"
4
4
  require "railsui/engine"
5
5
  require "railsui_icon"
6
6
  require "meta-tags"
7
+ require "tailwindcss-rails"
7
8
 
8
9
  module Railsui
9
10
  autoload :Configuration, "railsui/configuration"
@@ -29,15 +30,17 @@ module Railsui
29
30
  end
30
31
 
31
32
  def self.build_css
32
- if File.exist?("#{Rails.root}/package.json")
33
- package_json = JSON.parse(File.read("#{Rails.root}/package.json"))
34
- if package_json["scripts"] && package_json["scripts"]["build:css"]
35
- run_command "yarn build:css"
36
- else
37
- puts "'build:css' script not found in package.json, skipping"
33
+ # Use tailwindcss-rails gem for all CSS compilation (unified approach)
34
+ if defined?(Tailwindcss)
35
+ run_command "rails tailwindcss:build"
36
+
37
+ # Touch the built CSS file to update its timestamp and bust browser cache
38
+ css_file = Rails.root.join("app/assets/builds/tailwind.css")
39
+ if File.exist?(css_file)
40
+ FileUtils.touch(css_file)
38
41
  end
39
42
  else
40
- puts "package.json not found in the application root, skipping"
43
+ puts "tailwindcss-rails gem not found. Please install it to build CSS."
41
44
  end
42
45
  end
43
46
 
@@ -1,6 +1,12 @@
1
1
  namespace :railsui do
2
- desc 'Install Rails UI'
3
- task :install do
4
- system("#{RbConfig.ruby} ./bin/rails g railsui:install")
2
+ desc 'Install Rails UI (use --build for build mode, default is importmap)'
3
+ task :install, [:build_flag] do |t, args|
4
+ # Check if --build flag is present in ARGV
5
+ build_flag = ARGV.include?('--build') ? '--build' : ''
6
+
7
+ system("#{RbConfig.ruby} ./bin/rails g railsui:install #{build_flag}")
8
+
9
+ # Exit after running to prevent rake from trying to run additional tasks
10
+ exit(0)
5
11
  end
6
12
  end
@@ -0,0 +1,219 @@
1
+ namespace :railsui do
2
+ desc 'Migrate from cssbundling-rails to tailwindcss-rails'
3
+ task :migrate_to_tailwindcss_rails do
4
+ puts "🔄 Migrating Rails UI to use tailwindcss-rails gem..."
5
+ puts ""
6
+
7
+ # Check if cssbundling-rails is present
8
+ has_cssbundling = Gem::Specification.find_all_by_name('cssbundling-rails').any?
9
+
10
+ if has_cssbundling
11
+ puts "✓ Detected cssbundling-rails - will migrate to tailwindcss-rails"
12
+ else
13
+ puts "ℹ️ cssbundling-rails not found - you may already be using tailwindcss-rails"
14
+ end
15
+
16
+ puts ""
17
+ puts "This migration will:"
18
+ puts " 1. Install tailwindcss-rails gem (if not already installed)"
19
+ puts " 2. Remove Tailwind CSS from package.json"
20
+ puts " 3. Update Procfile.dev to use tailwindcss-rails"
21
+ puts " 4. Keep your JavaScript bundling setup intact"
22
+ puts ""
23
+ puts "Your current build mode will be preserved (JS bundling continues working)"
24
+ puts ""
25
+
26
+ print "Continue? (y/n): "
27
+ response = STDIN.gets.chomp.downcase
28
+
29
+ unless response == 'y'
30
+ puts "❌ Migration cancelled"
31
+ exit
32
+ end
33
+
34
+ puts ""
35
+ puts "Starting migration..."
36
+ puts ""
37
+
38
+ begin
39
+ # Step 1: Install tailwindcss-rails
40
+ unless Gem::Specification.find_all_by_name('tailwindcss-rails').any?
41
+ puts "📦 Installing tailwindcss-rails gem..."
42
+ unless system("bundle add tailwindcss-rails")
43
+ raise "Failed to install tailwindcss-rails gem"
44
+ end
45
+ puts "✓ tailwindcss-rails installed"
46
+ else
47
+ puts "✓ tailwindcss-rails already installed"
48
+ end
49
+
50
+ # Step 2: Remove Tailwind from package.json
51
+ package_json_path = Rails.root.join("package.json")
52
+ if File.exist?(package_json_path)
53
+ puts ""
54
+ puts "📝 Updating package.json..."
55
+
56
+ begin
57
+ package_json = JSON.parse(File.read(package_json_path))
58
+ rescue JSON::ParserError => e
59
+ raise "Failed to parse package.json: #{e.message}"
60
+ end
61
+
62
+ removed_packages = []
63
+
64
+ # Remove Tailwind-related packages
65
+ tailwind_packages = ['tailwindcss', '@tailwindcss/cli', '@tailwindcss/typography', '@tailwindcss/forms', '@tailwindcss/aspect-ratio', '@tailwindcss/container-queries']
66
+
67
+ if package_json['dependencies']
68
+ tailwind_packages.each do |pkg|
69
+ if package_json['dependencies'].delete(pkg)
70
+ removed_packages << pkg
71
+ end
72
+ end
73
+ end
74
+
75
+ if package_json['devDependencies']
76
+ tailwind_packages.each do |pkg|
77
+ if package_json['devDependencies'].delete(pkg)
78
+ removed_packages << pkg
79
+ end
80
+ end
81
+ end
82
+
83
+ # Remove build:css script
84
+ if package_json['scripts']&.key?('build:css')
85
+ package_json['scripts'].delete('build:css')
86
+ puts " - Removed 'build:css' script"
87
+ end
88
+
89
+ File.write(package_json_path, JSON.pretty_generate(package_json))
90
+
91
+ if removed_packages.any?
92
+ puts " - Removed packages: #{removed_packages.join(', ')}"
93
+ else
94
+ puts " - No Tailwind packages found to remove"
95
+ end
96
+
97
+ puts "✓ package.json updated"
98
+ end
99
+
100
+ # Step 3: Update Procfile.dev
101
+ procfile_path = Rails.root.join("Procfile.dev")
102
+ if File.exist?(procfile_path)
103
+ puts ""
104
+ puts "📝 Updating Procfile.dev..."
105
+
106
+ procfile_content = File.read(procfile_path)
107
+
108
+ # Replace CSS build commands
109
+ updated_content = procfile_content.gsub(/^css:.*$/, 'css: bin/rails tailwindcss:watch')
110
+
111
+ File.write(procfile_path, updated_content)
112
+ puts "✓ Procfile.dev updated to use 'rails tailwindcss:watch'"
113
+ else
114
+ puts ""
115
+ puts "⚠️ Procfile.dev not found - you may need to create one manually"
116
+ end
117
+
118
+ # Step 4: Run tailwindcss:install if needed
119
+ unless File.exist?(Rails.root.join("app/assets/builds/.keep"))
120
+ puts ""
121
+ puts "🎨 Setting up Tailwind CSS..."
122
+ begin
123
+ system("bin/rails tailwindcss:install") || raise("tailwindcss:install failed")
124
+ puts "✓ Tailwind CSS configured"
125
+ rescue => e
126
+ puts "⚠️ tailwindcss:install failed: #{e.message}"
127
+ puts "You may need to run 'bin/rails tailwindcss:install' manually"
128
+ end
129
+ end
130
+
131
+ # Step 4a: Create new CSS file for tailwindcss-rails v4
132
+ old_css_path = Rails.root.join("app/assets/stylesheets/application.tailwind.css")
133
+ new_css_path = Rails.root.join("app/assets/tailwind/application.css")
134
+
135
+ if File.exist?(old_css_path)
136
+ puts ""
137
+ puts "📦 Setting up CSS for tailwindcss-rails v4..."
138
+
139
+ # Create new directory
140
+ FileUtils.mkdir_p(Rails.root.join("app/assets/tailwind"))
141
+
142
+ unless File.exist?(new_css_path)
143
+ # Create new Tailwind CSS file with v4 directives
144
+ File.write(new_css_path, <<~CSS)
145
+ @import "tailwindcss";
146
+
147
+ /* Custom styles and imports go here */
148
+ CSS
149
+ puts "✓ Created new app/assets/tailwind/application.css"
150
+ end
151
+
152
+ puts ""
153
+ puts "⚠️ IMPORTANT: Manual action required!"
154
+ puts " Your existing CSS file has been preserved:"
155
+ puts " → app/assets/stylesheets/application.tailwind.css"
156
+ puts ""
157
+ puts " Please manually migrate any custom CSS, @import statements, or"
158
+ puts " legacy styles from the old file to:"
159
+ puts " → app/assets/tailwind/application.css"
160
+ puts ""
161
+ puts " After migrating, you can safely delete the old file."
162
+ elsif !File.exist?(new_css_path)
163
+ # No old file exists, create fresh new file
164
+ puts ""
165
+ puts "📦 Creating CSS file for tailwindcss-rails v4..."
166
+
167
+ FileUtils.mkdir_p(Rails.root.join("app/assets/tailwind"))
168
+ File.write(new_css_path, <<~CSS)
169
+ @import "tailwindcss";
170
+
171
+ /* Custom styles and imports go here */
172
+ CSS
173
+ puts "✓ Created app/assets/tailwind/application.css"
174
+ end
175
+
176
+ # Step 5: Update Rails UI config
177
+ config_path = Rails.root.join("config/railsui.yml")
178
+ if File.exist?(config_path)
179
+ puts ""
180
+ puts "📝 Updating Rails UI configuration..."
181
+
182
+ config = Psych.load_file(config_path, permitted_classes: [Hash, Railsui::Configuration])
183
+
184
+ # Ensure build mode is set (default to 'build' since they were using cssbundling)
185
+ unless config.is_a?(Hash) && config.key?('build_mode')
186
+ config['build_mode'] = 'build' if config.is_a?(Hash)
187
+ end
188
+
189
+ File.write(config_path, config.to_yaml)
190
+ puts "✓ Rails UI configuration updated"
191
+ end
192
+ rescue => e
193
+ puts ""
194
+ puts "❌ Migration failed: #{e.message}"
195
+ puts ""
196
+ puts "To retry manually:"
197
+ puts " 1. bundle add tailwindcss-rails"
198
+ puts " 2. Remove Tailwind packages from package.json"
199
+ puts " 3. Update Procfile.dev: css: bin/rails tailwindcss:watch"
200
+ puts " 4. bin/rails tailwindcss:install"
201
+ puts " 5. Update config/railsui.yml"
202
+ puts ""
203
+ puts "For detailed instructions, see: MIGRATION_GUIDE.md"
204
+ exit 1
205
+ end
206
+
207
+ puts ""
208
+ puts "✅ Migration complete!"
209
+ puts ""
210
+ puts "Next steps:"
211
+ puts " 1. Run 'bundle install' to ensure all gems are installed"
212
+ puts " 2. Update layouts to use: stylesheet_link_tag 'tailwind' (instead of 'application')"
213
+ puts " 3. Run 'bin/rails tailwindcss:build' to compile your CSS"
214
+ puts " 4. Start your server with 'bin/dev'"
215
+ puts ""
216
+ puts "Your JavaScript bundling setup remains unchanged."
217
+ puts "CSS is now handled by the faster tailwindcss-rails gem! 🚀"
218
+ end
219
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railsui
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.7
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Leverenz
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-09-12 00:00:00.000000000 Z
10
+ date: 2025-10-25 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -65,6 +65,20 @@ dependencies:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: tailwindcss-rails
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '2.0'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '2.0'
68
82
  description: Professionally designed UI components and templates for Ruby on Rails.
69
83
  email:
70
84
  - railsui@justalever.com
@@ -72,7 +86,6 @@ executables: []
72
86
  extensions: []
73
87
  extra_rdoc_files: []
74
88
  files:
75
- - ".claude/settings.local.json"
76
89
  - ".nvmrc"
77
90
  - Gemfile
78
91
  - Gemfile.lock
@@ -738,6 +751,7 @@ files:
738
751
  - app/assets/images/twitter.svg
739
752
  - app/assets/images/users.svg
740
753
  - app/assets/images/warning.svg
754
+ - app/assets/javascripts/railsui-controllers.js
741
755
  - app/assets/javascripts/railsui.js
742
756
  - app/assets/stylesheets/railsui/config.css
743
757
  - app/assets/stylesheets/railsui/docs.css
@@ -812,6 +826,7 @@ files:
812
826
  - app/views/railsui/routes/_nav.html.erb
813
827
  - app/views/railsui/routes/show.html.erb
814
828
  - app/views/railsui/shared/_callout.html.erb
829
+ - app/views/railsui/shared/_cdn_dependencies.html.erb
815
830
  - app/views/railsui/shared/_code_example.html.erb
816
831
  - app/views/railsui/shared/_code_example_heading.html.erb
817
832
  - app/views/railsui/shared/_component_nav.html.erb
@@ -824,6 +839,7 @@ files:
824
839
  - app/views/railsui/shared/_global_nav.html.erb
825
840
  - app/views/railsui/shared/_global_nav_item.html.erb
826
841
  - app/views/railsui/shared/_header.html.erb
842
+ - app/views/railsui/shared/_inline_controllers.html.erb
827
843
  - app/views/railsui/shared/_launcher.html.erb
828
844
  - app/views/railsui/shared/_linkable.html.erb
829
845
  - app/views/railsui/shared/_linkables.html.erb
@@ -1363,7 +1379,12 @@ files:
1363
1379
  - config/pages.yml
1364
1380
  - config/routes.rb
1365
1381
  - config/theme.yml
1382
+ - guides/CONFIGURATION.md
1383
+ - guides/MIGRATION_GUIDE.md
1366
1384
  - lib/generators/railsui/install/install_generator.rb
1385
+ - lib/generators/railsui/install/templates/Procfile.dev.build
1386
+ - lib/generators/railsui/install/templates/Procfile.dev.nobuild
1387
+ - lib/generators/railsui/install/templates/bin/dev
1367
1388
  - lib/generators/railsui/install/templates/controllers/pages_controller.rb
1368
1389
  - lib/generators/railsui/install/templates/themes/corgie/images/railsui/auth-bg.jpg
1369
1390
  - lib/generators/railsui/install/templates/themes/corgie/images/railsui/blog-feature.jpg
@@ -1440,7 +1461,7 @@ files:
1440
1461
  - lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/help.html.erb
1441
1462
  - lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/home.html.erb
1442
1463
  - lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/pricing.html.erb
1443
- - lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/privacy.html.erb
1464
+ - lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/privacy_policy.html.erb
1444
1465
  - lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/signin.html.erb
1445
1466
  - lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/signup.html.erb
1446
1467
  - lib/generators/railsui/install/templates/themes/corgie/views/rui/pages/terms.html.erb
@@ -1769,6 +1790,7 @@ files:
1769
1790
  - lib/railsui/themes.rb
1770
1791
  - lib/railsui/version.rb
1771
1792
  - lib/tasks/install.rake
1793
+ - lib/tasks/migrate.rake
1772
1794
  - lib/tasks/pages.rake
1773
1795
  - lib/tasks/stimulus.rake
1774
1796
  - package.json
@@ -1,10 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(find:*)",
5
- "Bash(grep:*)"
6
- ],
7
- "deny": [],
8
- "ask": []
9
- }
10
- }