Skip to content

Commit 0d9edb2

Browse files
authored
Merge branch 'main' into tailwind-config-js-lookup
Signed-off-by: Joel Drapper <[email protected]>
2 parents 0ae1ff5 + 51fd83a commit 0d9edb2

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

lib/generators/phlex/install/install_generator.rb

+11-23
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,21 @@ class InstallGenerator < ::Rails::Generators::Base
66

77
APPLICATION_CONFIGURATION_PATH = Rails.root.join("config/application.rb")
88

9-
def autoload_components
9+
ADD_EXTRA_AUTOLOAD_PATHS_CODE = <<-ADD_EXTRA_AUTOLOAD_PATHS_CODE
10+
config.autoload_paths.push(
11+
"\#{root}/app/views/components",
12+
"\#{root}/app/views",
13+
"\#{root}/app/views/layouts"
14+
)
15+
ADD_EXTRA_AUTOLOAD_PATHS_CODE
16+
17+
def autoload_components_layouts_views
1018
return unless APPLICATION_CONFIGURATION_PATH.exist?
1119

1220
inject_into_class(
1321
APPLICATION_CONFIGURATION_PATH,
1422
"Application",
15-
%( config.autoload_paths << "\#{root}/app/views/components"\n),
16-
)
17-
end
18-
19-
def autoload_layouts
20-
return unless APPLICATION_CONFIGURATION_PATH.exist?
21-
22-
inject_into_class(
23-
APPLICATION_CONFIGURATION_PATH,
24-
"Application",
25-
%( config.autoload_paths << "\#{root}/app/views/layouts"\n),
26-
)
27-
end
28-
29-
def autoload_views
30-
return unless APPLICATION_CONFIGURATION_PATH.exist?
31-
32-
inject_into_class(
33-
APPLICATION_CONFIGURATION_PATH,
34-
"Application",
35-
%( config.autoload_paths << "\#{root}/app/views"\n),
23+
ADD_EXTRA_AUTOLOAD_PATHS_CODE,
3624
)
3725
end
3826

@@ -56,7 +44,7 @@ def create_application_view
5644
template "application_view.rb", Rails.root.join("app/views/application_view.rb")
5745
end
5846

59-
private
47+
private
6048

6149
def tailwind_configuration_path
6250
@_tailwind_configuration_path ||=

0 commit comments

Comments
 (0)